calendar
lr + dicos description + cleanup
This commit is contained in:
@@ -56,7 +56,7 @@ def modify_event(event):
|
||||
global latest_week
|
||||
global deficit
|
||||
|
||||
if event.name and "DICOS" in event.name:
|
||||
if event.name is not None and "DICOS" in event.name:
|
||||
length = (event.end - event.begin).seconds / 3600
|
||||
money_made = divmod(length * NETTO_STUNDE, 1)
|
||||
|
||||
@@ -78,9 +78,14 @@ def modify_event(event):
|
||||
latest_goal = goal
|
||||
latest_week = week
|
||||
|
||||
progress_line = f"({fraction_to_unicode(progress)}/{fraction_to_unicode(goal)})"
|
||||
new_description = [event.description.split("\n")[0] or "::"]
|
||||
new_description.append("")
|
||||
new_description.append(f"Netto: {money_made[0]:.0f},{int(money_made[1] * 10):02d}€")
|
||||
new_description.append(f"This weeks porgress: ({fraction_to_unicode(progress)}/{fraction_to_unicode(goal)})")
|
||||
new_description.append(f"This weeks deficit: {fraction_to_unicode(deficit)}")
|
||||
|
||||
event.description = "\n".join(new_description)
|
||||
|
||||
event.description = f"Netto: {money_made[0]:.0f},{int(money_made[1] * 10):02d}€\nThis weeks porgress: {progress_line}\nThis weeks deficit: {fraction_to_unicode(deficit)}"
|
||||
event.name = f"DICOS {fraction_to_unicode(length)}"
|
||||
return event
|
||||
|
||||
@@ -92,7 +97,7 @@ def process_ics_file(filepath):
|
||||
modified = False
|
||||
|
||||
for event in calendar.events:
|
||||
if 'DICOS' in event.name:
|
||||
if event.name is not None and 'DICOS' in event.name:
|
||||
event = modify_event(event)
|
||||
modified = True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user