27 lines
1.2 KiB
HTML
27 lines
1.2 KiB
HTML
|
{{- $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 -}}
|
||
|
|
||
|
{{- $this_year_total := len ( where ( where $log_file "date_finished" "gt" ( ( $today.AddDate -1 0 0 ).Format "2006-01-02" ) ) "date_finished" "lt" "2024-12-31" ) -}}
|
||
|
{{- $this_quarter_total := len ( where ( where $log_file "date_finished" "gt" ( ( $today.AddDate 0 -3 0 ).Format "2006-01-02" ) ) "date_finished" "lt" "2024-09-30" ) -}}
|
||
|
{{- $this_month_total := len ( where ( where $log_file "date_finished" "gt" ( ( $today.AddDate 0 -1 0 ).Format "2006-01-02" ) ) "date_finished" "lt" "2024-07-31" ) -}}
|
||
|
|
||
|
<details class="log-stats">
|
||
|
<summary>Summary</summary>
|
||
|
|
||
|
<div>
|
||
|
<p>Total: {{ $total }}</p>
|
||
|
{{- if eq $list_mode "log" -}}
|
||
|
<p>Last 12 months: {{ $this_year_total }}</p>
|
||
|
<p>Last 3 months: {{ $this_quarter_total }}</p>
|
||
|
<p>Last month: {{ $this_month_total }}</p>
|
||
|
{{- end -}}
|
||
|
</div>
|
||
|
</details>
|
||
|
{{- end -}}
|