This commit is contained in:
Martin Folkerts 2024-07-19 10:57:50 +02:00
parent 24cbea7b0b
commit 8bac58b121
3 changed files with 21 additions and 2 deletions

View file

@ -9,6 +9,9 @@ for arg in "$@"; do
--report_date=*) --report_date=*)
report_date="${arg#*=}" report_date="${arg#*=}"
;; ;;
--mail_day=*)
mail_day="${arg#*=}"
;;
--data_dir=*) --data_dir=*)
data_dir="${arg#*=}" data_dir="${arg#*=}"
;; ;;
@ -20,7 +23,7 @@ for arg in "$@"; do
done done
# Check if required arguments are set # Check if required arguments are set
if [ -z "$filename" ] || [ -z "$report_date" ] || [ -z "$data_dir" ]; then if [ -z "$filename" ] || [ -z "$report_date" ]|| [ -z "$mail_day" ] || [ -z "$data_dir" ]; then
echo "Missing arguments. Use: build_reports.sh --filename=hello.txt --report_date=2020-01-01 --data_dir=chemba" echo "Missing arguments. Use: build_reports.sh --filename=hello.txt --report_date=2020-01-01 --data_dir=chemba"
exit 1 exit 1
fi fi
@ -28,6 +31,7 @@ fi
# Script logic here # Script logic here
echo "Filename: $filename" echo "Filename: $filename"
echo "Report date: $report_date" echo "Report date: $report_date"
echo "Mail day: $mail_day"
echo "Data directory: $data_dir" echo "Data directory: $data_dir"
if [ "$(uname)" == "Darwin" ]; then if [ "$(uname)" == "Darwin" ]; then

View file

@ -42,6 +42,7 @@ public function handle()
sprintf('%sbuild_report.sh', $projectFolder), sprintf('%sbuild_report.sh', $projectFolder),
sprintf('--filename=%s', $this->projectReport->getFullPathName()), sprintf('--filename=%s', $this->projectReport->getFullPathName()),
sprintf('--report_date=%s', $this->projectReport->getReportDate()), sprintf('--report_date=%s', $this->projectReport->getReportDate()),
sprintf('--mail_day=%s', $this->mail_day),
sprintf('--data_dir=%s', $this->projectReport->project->download_path), sprintf('--data_dir=%s', $this->projectReport->project->download_path),
]; ];
logger('command:'. print_r($command, true)); logger('command:'. print_r($command, true));

View file

@ -4,6 +4,7 @@ params:
output_file: CI_report.docx output_file: CI_report.docx
report_date: "2024-04-18" report_date: "2024-04-18"
data_dir: "Sony" data_dir: "Sony"
mail_day: "Wednesday"
output: output:
# html_document: # html_document:
# toc: yes # toc: yes
@ -20,6 +21,7 @@ editor_options:
# knitr::opts_chunk$set(echo = TRUE) # knitr::opts_chunk$set(echo = TRUE)
# output_file <- params$output_file # output_file <- params$output_file
report_date <- params$report_date report_date <- params$report_date
report_date <- params$mail_day
# #
# #
# # Activeer de renv omgeving # # Activeer de renv omgeving
@ -71,7 +73,18 @@ source(here("r_app", "parameters_project.R"))
```{r week, message=FALSE, warning=FALSE, include=FALSE} ```{r week, message=FALSE, warning=FALSE, include=FALSE}
today <- as.character(report_date) today <- as.character(report_date)
week <- week(today) report_date_as_week_day = wday(today)
days_of_week <- c("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")
#als de index of report_date_as_week_day groter dan de index van de mail_day dan moet de week + 1
if (which(days_of_week == report_date_as_week_day) > which(days_of_week == mail_day)){
week <- week(today) + 1
} else {
week <- week(today)
}
# week <- week(today)
# week <- 25 # week <- 25
# today = "2024-06-21" # today = "2024-06-21"
@ -117,6 +130,7 @@ This PDF-dashboard shows the status of your fields on a weekly basis. We will sh
CI_quadrant <- readRDS(here(cumulative_CI_vals_dir,"All_pivots_Cumulative_CI_quadrant_year_v2.rds"))# %>% CI_quadrant <- readRDS(here(cumulative_CI_vals_dir,"All_pivots_Cumulative_CI_quadrant_year_v2.rds"))# %>%
# rename(pivot_quadrant = field) # rename(pivot_quadrant = field)
path_to_week_current = here(weekly_CI_mosaic, paste0("week_",week, "_", year, ".tif")) path_to_week_current = here(weekly_CI_mosaic, paste0("week_",week, "_", year, ".tif"))
path_to_week_minus_1 = here(weekly_CI_mosaic, paste0("week_",week_minus_1, "_", year_1, ".tif")) path_to_week_minus_1 = here(weekly_CI_mosaic, paste0("week_",week_minus_1, "_", year_1, ".tif"))
path_to_week_minus_2 = here(weekly_CI_mosaic, paste0("week_",week_minus_2, "_", year_2, ".tif")) path_to_week_minus_2 = here(weekly_CI_mosaic, paste0("week_",week_minus_2, "_", year_2, ".tif"))