]>
apps.delaporte.us Git - dotfiles.git/blob - invoke/school/tasks.py
b1dbdca85401a831dae11c09ec303d96b65d15ac
1 # This file is meant to sit in ~ for use from all shells.
2 from invoke
import task
3 from pandas_ods_reader
import read_ods
6 from datetime
import datetime
as dt
7 from datetime
import timedelta
10 HOME
= os
.path
.expanduser('~')
11 DATE_FORMAT
= '%Y-%m-%d'
12 TODAY
= dt
.now().strftime(DATE_FORMAT
)
14 SCHOOL_DIR
= f
'{HOME}/School/Assignments'
15 ODS_FILE
= f
'{HOME}/School/Assignments/tasks.ods'
16 BIN
= f
'{HOME}/envs/invoke/bin'
17 STUDENTS
= os
.environ
.get('STUDENTS').split('|')
22 df
= read_ods(ODS_FILE
)
27 def print_week(c
, person
, monday
):
28 print(f
'# {person}\'s Assignements for Week of {monday}')
30 day
= dt
.strptime(monday
, DATE_FORMAT
)
32 print_day(c
, person
, day
.strftime(DATE_FORMAT
))
33 day
= day
+ timedelta(days
=1)
36 def md_week(c
, person
, monday
):
37 c
.run(f
'cd {SCHOOL_DIR};{BIN}/invoke print-week {person} {monday} > {person}.{monday}.md')
41 def show_all(c
, monday
):
42 for person
in STUDENTS
:
43 md_week(c
, person
, monday
)
44 c
.run(f
'codium {person}.{monday}.md')
47 def html_all(c
, monday
):
48 for person
in STUDENTS
:
49 md_week(c
, person
, monday
)
50 c
.run(f
'cd {SCHOOL_DIR};{BIN}/markdown_py {person}.{monday}.md > {person}.{monday}.html')
51 c
.run(f
'librewolf {person}.{monday}.html')
54 def get_todays_assignments(df
, date
, person
):
55 mine
= df
[df
['person'] == person
]
56 today
= mine
[mine
['date'] == date
]
60 def missing_on_day(c
, person
, day
):
61 df
= read_ods(ODS_FILE
)
62 today
= get_todays_assignments(df
, day
, person
)
63 for subject
in ['College Prep', 'Life Skills', 'Job Prep']:
64 if not subject
in today
['subject'].values
:
65 print(f
'Missing {subject} for {person} on {day}')
68 def missing(c
, monday
, person
=None):
71 for person
in STUDENTS
:
72 missing(c
, monday
, person
)
74 day
= dt
.strptime(monday
, DATE_FORMAT
)
76 missing_on_day(c
, person
, day
.strftime(DATE_FORMAT
))
77 day
= day
+ timedelta(days
=1)
80 def print_day(c
, person
, date
):
81 df
= read_ods(ODS_FILE
)
82 # df['date'] = pd.to_datetime(df['date'], format='%Y-%m-%d')
83 # today = df.loc(df['date'] >= '2026-01-12')
84 mine
= df
[df
['person'] == person
]
85 today
= mine
[mine
['date'] == date
]
87 weekday
= dt
.strptime(date
, DATE_FORMAT
).strftime('%A')
91 print(f
"## {person}'s Assignments for {weekday}, {date}")
93 for _
, row
in today
.iterrows():
96 print(f
'### {row["subject"]}')
101 print(f
'> Tip: {row["tip"]}')
103 if(row
['when_done']):
105 print(f
'**When done**: {row["when_done"]}')