@@ -43,7 +43,7 @@ tkl_push_trap 'gh_flush_print_buffers; gh_prepend_changelog_file' EXIT
4343
4444gh_print_notice_and_write_to_changelog_text_ln " current date/time: $current_date_time_utc " " $current_date_time_utc :"
4545
46- current_date_utc=${current_date_time_utc/% T* }
46+ current_date_utc=" ${current_date_time_utc/% T* } "
4747
4848# exit with non 0 code if nothing is changed
4949IFS=$' \n ' read -r -d ' ' last_replies last_views <<< " $(jq -c -r " .replies,.views" $stats_json )"
@@ -102,50 +102,42 @@ stats_prev_exec_replies_inc=0
102102stats_prev_exec_views_inc=0
103103
104104if [[ -n " $replies " ]]; then
105- (( last_replies < replies )) && (( stats_prev_exec_replies_inc= replies- last_replies ))
105+ (( last_replies < replies )) && (( stats_prev_exec_replies_inc = replies - last_replies ))
106106fi
107107if [[ -n " $views " ]]; then
108- (( last_views < views )) && (( stats_prev_exec_views_inc= views- last_views ))
108+ (( last_views < views )) && (( stats_prev_exec_views_inc = views - last_views ))
109109fi
110110
111111gh_print_notice_and_write_to_changelog_text_bullet_ln " query file size: $( stat -c%s " $TEMP_DIR /response.txt" ) "
112112
113- gh_print_notice_and_write_to_changelog_text_bullet_ln " json prev / next / diff: re vi: $last_replies $last_views / ${replies:- " -" } ${views:- " -" } / +$stats_prev_exec_replies_inc +$stats_prev_exec_views_inc "
113+ gh_print_notice_and_write_to_changelog_text_bullet_ln " accum prev / next / diff: re vi: $last_replies $last_views / ${replies:- " -" } ${views:- " -" } / +$stats_prev_exec_replies_inc +$stats_prev_exec_views_inc "
114114
115115# with check on integer value
116116[[ -z " $replies " || -n " ${replies// [0-9]/ } " ]] && replies=$last_replies
117117[[ -z " $views " || -n " ${views// [0-9]/ } " ]] && views=$last_views
118118
119- # stats between last change in previous/next day (independent to the pipeline scheduler times)
120- stats_prev_day_replies_inc=0
121- stats_prev_day_views_inc=0
122-
119+ # stats between last date and previous date (independent to the pipeline scheduler times)
123120replies_saved=0
124121views_saved=0
125- replies_prev_day_inc_saved=0
126- views_prev_day_inc_saved=0
127122
128- timestamp_date_utc=${current_date_time_utc/% T* }
129- timestamp_year_utc=${timestamp_date_utc/% -* }
123+ timestamp_date_utc=" ${current_date_time_utc/% T* } "
124+ timestamp_year_utc=" ${timestamp_date_utc/% -* } "
130125timestamp_year_dir=" $stats_by_year_dir /$timestamp_year_utc "
131126year_date_json=" $timestamp_year_dir /$timestamp_date_utc .json"
132127
133128if [[ -f " $year_date_json " ]]; then
134- IFS=$' \n ' read -r -d ' ' replies_saved views_saved replies_prev_day_inc_saved views_prev_day_inc_saved <<< \
135- "$( jq -c -r " .replies,.views,.replies_prev_day_inc,.views_prev_day_inc " $year_date_json ) "
129+ IFS=$' \n ' read -r -d ' ' replies_saved views_saved <<< \
130+ "$( jq -c -r " .replies,.views" $year_date_json ) "
136131
137132 # CAUTION:
138133 # Prevent of invalid values spread if upstream user didn't properly commit completely correct json file or didn't commit at all.
139134 #
140135 jq_fix_null \
141- replies_saved:0 views_saved:0 \
142- replies_prev_day_inc_saved:0 views_prev_day_inc_saved:0
136+ replies_saved:0 views_saved:0
143137fi
144138
145- (( stats_prev_day_replies_inc+=replies_prev_day_inc_saved+stats_prev_exec_replies_inc ))
146- (( stats_prev_day_views_inc+=views_prev_day_inc_saved+stats_prev_exec_views_inc ))
147-
148- gh_print_notice_and_write_to_changelog_text_bullet_ln "prev day diff: re vi: +$stats_prev_day_replies_inc +$stats_prev_day_views_inc "
139+ (( replies_saved += stats_prev_exec_replies_inc ))
140+ (( views_saved += stats_prev_exec_views_inc ))
149141
150142if (( replies != last_replies || views != last_views )); then
151143 echo "\
@@ -161,9 +153,7 @@ if (( replies != last_replies || views != last_views )); then
161153{
162154 \"timestamp\" : \"$current_date_time_utc \",
163155 \"replies\" : $replies_saved ,
164- \"replies_prev_day_inc\" : $stats_prev_day_replies_inc ,
165- \"views\" : $views_saved ,
166- \"views_prev_day_inc\" : $stats_prev_day_views_inc
156+ \"views\" : $views_saved
167157}" > "$year_date_json "
168158fi
169159
@@ -199,9 +189,6 @@ gh_set_env_var STATS_DATE_TIME_UTC "$current_date_time_utc"
199189gh_set_env_var STATS_PREV_EXEC_REPLIES_INC "$stats_prev_exec_replies_inc "
200190gh_set_env_var STATS_PREV_EXEC_VIEWS_INC "$stats_prev_exec_views_inc "
201191
202- gh_set_env_var STATS_PREV_DAY_REPLIES_INC "$stats_prev_day_replies_inc "
203- gh_set_env_var STATS_PREV_DAY_VIEWS_INC "$stats_prev_day_views_inc "
204-
205192gh_set_env_var COMMIT_MESSAGE_DATE_TIME_PREFIX "$commit_message_date_time_prefix "
206193
207194gh_set_env_var COMMIT_MESSAGE_PREFIX "re vi: +$stats_prev_exec_replies_inc +$stats_prev_exec_views_inc / $replies_saved $views_saved "
0 commit comments