Verified Commit c030e371 authored by Luc Didry's avatar Luc Didry
Browse files

Fix stats graph if no upload happens in the time range

parent 85d0aabe
Pipeline #65252 passed with stages
in 5 minutes and 55 seconds
Revision history for Lutim
0.11.2 2018-07-31
- Fix stats graph if no upload happens in the time range
0.11.1 2018-07-30
- Add upload_enabled info to server infos endpoint
- Add log message when failing to render an image
......
......@@ -71,15 +71,27 @@ sub run {
);
my $total = $img->count_created_before($separation);
for my $year (sort {$a <=> $b} keys %data) {
for my $month (sort {$a <=> $b} keys %{$data{$year}}) {
for my $day (sort {$a <=> $b} keys %{$data{$year}->{$month}}) {
$thead_tr->append_content('<th>'."$day/$month/$year".'</th>'."\n");
$tbody_tr->append_content('<td>'.$data{$year}->{$month}->{$day}.'</td>'."\n");
$total += $data{$year}->{$month}->{$day};
$tbody_t2->append_content('<td>'.$total.'</td>'."\n");
if (scalar(keys %data)) {
for my $year (sort {$a <=> $b} keys %data) {
for my $month (sort {$a <=> $b} keys %{$data{$year}}) {
for my $day (sort {$a <=> $b} keys %{$data{$year}->{$month}}) {
$thead_tr->append_content(sprintf("<th>%#.2d/%#.2d/%d</th>\n", $day, $month, $year));
$tbody_tr->append_content(sprintf("<td>%d</td>\n", $data{$year}->{$month}->{$day}));
$total += $data{$year}->{$month}->{$day};
$tbody_t2->append_content(sprintf("<td>%d</td>\n", $total));
}
}
}
} else {
my $dt = DateTime->from_epoch(epoch => $separation);
$thead_tr->append_content(sprintf("<th>%#.2d/%#.2d/%d</th>\n", $dt->day(), $dt->month(), $dt->year()));
$tbody_tr->append_content("<td>0</td>\n");
$tbody_t2->append_content(sprintf("<td>%d</td>\n", $total));
$dt = DateTime->now();
$thead_tr->append_content(sprintf("<th>%#.2d/%#.2d/%d</th>\n", $dt->day(), $dt->month(), $dt->year()));
$tbody_tr->append_content("<td>0</td>\n");
$tbody_t2->append_content(sprintf("<td>%d</td>\n", $total));
}
my $moy = $total / $config->{stats_day_num};
......
......@@ -19,7 +19,7 @@ msgstr ""
#. (30)
#. ($delay)
#. (config('max_delay')
#: lib/Lutim/Command/cron/stats.pm:147 lib/Lutim/Command/cron/stats.pm:148 lib/Lutim/Command/cron/stats.pm:161 lib/Lutim/Command/cron/stats.pm:162 lib/Lutim/Command/cron/stats.pm:178 lib/Lutim/Command/cron/stats.pm:179 themes/default/templates/myfiles.html.ep:24 themes/default/templates/myfiles.html.ep:33 themes/default/templates/myfiles.html.ep:34 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/for_my_delay.html.ep:14 themes/default/templates/partial/for_my_delay.html.ep:4 themes/default/templates/partial/lutim.js.ep:140 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/lutim.js.ep:150 themes/default/templates/partial/raw.js.ep:23 themes/default/templates/partial/raw.js.ep:24 themes/default/templates/partial/raw.js.ep:6 themes/default/templates/partial/raw.js.ep:7 themes/default/templates/raw.html.ep:8 themes/default/templates/raw.html.ep:9
#: lib/Lutim/Command/cron/stats.pm:159 lib/Lutim/Command/cron/stats.pm:160 lib/Lutim/Command/cron/stats.pm:173 lib/Lutim/Command/cron/stats.pm:174 lib/Lutim/Command/cron/stats.pm:190 lib/Lutim/Command/cron/stats.pm:191 themes/default/templates/myfiles.html.ep:24 themes/default/templates/myfiles.html.ep:33 themes/default/templates/myfiles.html.ep:34 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/for_my_delay.html.ep:14 themes/default/templates/partial/for_my_delay.html.ep:4 themes/default/templates/partial/lutim.js.ep:140 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/lutim.js.ep:150 themes/default/templates/partial/raw.js.ep:23 themes/default/templates/partial/raw.js.ep:24 themes/default/templates/partial/raw.js.ep:6 themes/default/templates/partial/raw.js.ep:7 themes/default/templates/raw.html.ep:8 themes/default/templates/raw.html.ep:9
msgid "%1 days"
msgstr ""
......@@ -32,11 +32,11 @@ msgstr ""
msgid "-or-"
msgstr ""
#: lib/Lutim.pm:350 lib/Lutim/Command/cron/stats.pm:149 lib/Lutim/Command/cron/stats.pm:163 lib/Lutim/Command/cron/stats.pm:180 themes/default/templates/index.html.ep:5 themes/default/templates/myfiles.html.ep:5 themes/default/templates/partial/raw.js.ep:25 themes/default/templates/partial/raw.js.ep:8 themes/default/templates/raw.html.ep:10
#: lib/Lutim.pm:350 lib/Lutim/Command/cron/stats.pm:161 lib/Lutim/Command/cron/stats.pm:175 lib/Lutim/Command/cron/stats.pm:192 themes/default/templates/index.html.ep:5 themes/default/templates/myfiles.html.ep:5 themes/default/templates/partial/raw.js.ep:25 themes/default/templates/partial/raw.js.ep:8 themes/default/templates/raw.html.ep:10
msgid "1 year"
msgstr ""
#: lib/Lutim.pm:349 lib/Lutim/Command/cron/stats.pm:146 lib/Lutim/Command/cron/stats.pm:160 lib/Lutim/Command/cron/stats.pm:177 themes/default/templates/index.html.ep:4 themes/default/templates/myfiles.html.ep:33 themes/default/templates/myfiles.html.ep:4 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/raw.js.ep:22 themes/default/templates/partial/raw.js.ep:5 themes/default/templates/raw.html.ep:7
#: lib/Lutim.pm:349 lib/Lutim/Command/cron/stats.pm:158 lib/Lutim/Command/cron/stats.pm:172 lib/Lutim/Command/cron/stats.pm:189 themes/default/templates/index.html.ep:4 themes/default/templates/myfiles.html.ep:33 themes/default/templates/myfiles.html.ep:4 themes/default/templates/partial/for_my_delay.html.ep:13 themes/default/templates/partial/lutim.js.ep:149 themes/default/templates/partial/raw.js.ep:22 themes/default/templates/partial/raw.js.ep:5 themes/default/templates/raw.html.ep:7
msgid "24 hours"
msgstr ""
......@@ -48,7 +48,7 @@ msgstr ""
msgid "About"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:142 themes/default/templates/raw.html.ep:3
#: lib/Lutim/Command/cron/stats.pm:154 themes/default/templates/raw.html.ep:3
msgid "Active images"
msgstr ""
......@@ -108,11 +108,11 @@ msgstr ""
msgid "Delete at first view?"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:143 themes/default/templates/raw.html.ep:4
#: lib/Lutim/Command/cron/stats.pm:155 themes/default/templates/raw.html.ep:4
msgid "Deleted images"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:144 themes/default/templates/raw.html.ep:5
#: lib/Lutim/Command/cron/stats.pm:156 themes/default/templates/raw.html.ep:5
msgid "Deleted images in 30 days"
msgstr ""
......@@ -204,7 +204,7 @@ msgstr ""
msgid "Image URL"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:141 themes/default/templates/raw.html.ep:2
#: lib/Lutim/Command/cron/stats.pm:153 themes/default/templates/raw.html.ep:2
msgid "Image delay"
msgstr ""
......@@ -457,7 +457,7 @@ msgstr ""
msgid "Toggle navigation"
msgstr ""
#: lib/Lutim/Command/cron/stats.pm:150 themes/default/templates/raw.html.ep:11
#: lib/Lutim/Command/cron/stats.pm:162 themes/default/templates/raw.html.ep:11
msgid "Total"
msgstr ""
......@@ -559,7 +559,7 @@ msgstr ""
msgid "core developer"
msgstr ""
#: lib/Lutim.pm:348 lib/Lutim/Command/cron/stats.pm:145 lib/Lutim/Command/cron/stats.pm:159 lib/Lutim/Command/cron/stats.pm:176 themes/default/templates/index.html.ep:3 themes/default/templates/myfiles.html.ep:3 themes/default/templates/partial/raw.js.ep:21 themes/default/templates/partial/raw.js.ep:4 themes/default/templates/raw.html.ep:6
#: lib/Lutim.pm:348 lib/Lutim/Command/cron/stats.pm:157 lib/Lutim/Command/cron/stats.pm:171 lib/Lutim/Command/cron/stats.pm:188 themes/default/templates/index.html.ep:3 themes/default/templates/myfiles.html.ep:3 themes/default/templates/partial/raw.js.ep:21 themes/default/templates/partial/raw.js.ep:4 themes/default/templates/raw.html.ep:6
msgid "no time limit"
msgstr ""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment