Add template option to sort entries chronologically

This commit is contained in:
Joscha 2024-11-04 15:57:07 +01:00
parent 55b21c28e6
commit d30cd79229
2 changed files with 8 additions and 0 deletions

View file

@ -507,6 +507,7 @@
monthly_hours: 40,
hourly_wage: [14.09],
validate: true,
sort: true,
carry_prev_month: "00:00",
year: 2024,
month: 1,
@ -521,6 +522,10 @@
entries = entries.pos()
assert(entries.len() <= _kit_rows, message: "at most " + str(_kit_rows) + " entries allowed")
if sort {
entries = entries.sorted(key: entry => (entry.day, entry.end, entry.start))
}
let monthly = monthly_hours * 60
let holiday = entries.filter(e => e.note == notes.Urlaub).map(e => e.duration).sum(default: 0)
let total = entries.map(e => e.duration).sum(default: 0)