2024-07-23 07:57:11 +00:00
|
|
|
{{- $section := default "" ( .Scratch.Get "section" ) -}}
|
|
|
|
{{- $list_mode := default "" ( .Scratch.Get "listMode" ) -}}
|
|
|
|
{{- $log_file := index ( index $.Site.Data $section ) $list_mode -}}
|
|
|
|
|
|
|
|
{{- if $log_file -}}
|
|
|
|
{{- $total := len $log_file -}}
|
|
|
|
|
|
|
|
{{- $today := time.Now -}}
|
|
|
|
|
2024-12-21 22:23:09 +00:00
|
|
|
{{-
|
|
|
|
$this_year_total := (
|
|
|
|
where (
|
|
|
|
where $log_file "date_finished" "gt" (
|
|
|
|
( $today.AddDate -1 0 0 ).Format "2006-01-02"
|
|
|
|
)
|
|
|
|
) "date_finished" "lt" ( $today.Format "2006-01-02" )
|
|
|
|
) | len
|
|
|
|
-}}
|
|
|
|
|
|
|
|
{{-
|
|
|
|
$this_quarter_total := (
|
|
|
|
where (
|
|
|
|
where $log_file "date_finished" "gt" (
|
|
|
|
( $today.AddDate 0 -3 0 ).Format "2006-01-02"
|
|
|
|
)
|
|
|
|
) "date_finished" "lt" ( $today.Format "2006-01-02" )
|
|
|
|
) | len
|
|
|
|
-}}
|
|
|
|
{{-
|
|
|
|
$this_month_total := (
|
|
|
|
where (
|
|
|
|
where $log_file "date_finished" "gt" (
|
|
|
|
( $today.AddDate 0 -1 0 ).Format "2006-01-02"
|
|
|
|
)
|
|
|
|
) "date_finished" "lt" ( $today.Format "2006-01-02" )
|
|
|
|
) | len
|
|
|
|
-}}
|
2024-07-23 07:57:11 +00:00
|
|
|
|
|
|
|
<details class="log-stats">
|
|
|
|
<summary>Summary</summary>
|
|
|
|
|
|
|
|
<div>
|
2024-12-21 22:23:09 +00:00
|
|
|
<p>Total: {{ lang.FormatNumber 0 $total }}</p>
|
2024-07-23 07:57:11 +00:00
|
|
|
{{- if eq $list_mode "log" -}}
|
2024-12-21 22:23:09 +00:00
|
|
|
<p>Last 12 months: {{ lang.FormatNumber 0 $this_year_total }}</p>
|
|
|
|
<p>Last 3 months: {{ lang.FormatNumber 0 $this_quarter_total }}</p>
|
|
|
|
<p>Last month: {{ lang.FormatNumber 0 $this_month_total }}</p>
|
2024-07-23 07:57:11 +00:00
|
|
|
{{- end -}}
|
|
|
|
</div>
|
|
|
|
</details>
|
|
|
|
{{- end -}}
|