]> apps.delaporte.us Git - dotfiles.git/blobdiff - invoke/school/tasks.py
Update school tasks
[dotfiles.git] / invoke / school / tasks.py
index b1dbdca85401a831dae11c09ec303d96b65d15ac..e3f492870e2508507a4c7013fe102ddec54e7926 100644 (file)
@@ -12,10 +12,15 @@ DATE_FORMAT = '%Y-%m-%d'
 TODAY = dt.now().strftime(DATE_FORMAT)
 
 SCHOOL_DIR = f'{HOME}/School/Assignments'
-ODS_FILE = f'{HOME}/School/Assignments/tasks.ods'
+ODS_FILE = f'{HOME}/School/Assignments/assignments.ods'
 BIN = f'{HOME}/envs/invoke/bin'
 STUDENTS = os.environ.get('STUDENTS').split('|')
 
+@task
+def open_assignments(c):
+    print("LibreOffice does not like to be launched this way.")
+    # c.run(f'libreoffice {ODS_FILE}', asynchronous=True)
+
 
 @task
 def dump_ods(c):
@@ -34,21 +39,21 @@ def print_week(c, person, monday):
 
 @task
 def md_week(c, person, monday):
-    c.run(f'cd {SCHOOL_DIR};{BIN}/invoke print-week {person} {monday} > {person}.{monday}.md')
+    c.run(f'cd {SCHOOL_DIR};{BIN}/invoke print-week {person} {monday} > {SCHOOL_DIR}/{person}.{monday}.md')
 
 
 @task
 def show_all(c, monday):
     for person in STUDENTS:
         md_week(c, person, monday)
-        c.run(f'codium {person}.{monday}.md')
+        c.run(f'codium {SCHOOL_DIR}/{person}.{monday}.md')
 
 @task
 def html_all(c, monday):
     for person in STUDENTS:
         md_week(c, person, monday)
-        c.run(f'cd {SCHOOL_DIR};{BIN}/markdown_py {person}.{monday}.md > {person}.{monday}.html')
-        c.run(f'librewolf {person}.{monday}.html')
+        c.run(f'cd {SCHOOL_DIR};{BIN}/markdown_py {person}.{monday}.md > {SCHOOL_DIR}/{person}.{monday}.html')
+        c.run(f'librewolf {SCHOOL_DIR}/{person}.{monday}.html', asynchronous=True)
 
 
 def get_todays_assignments(df, date, person):
@@ -61,7 +66,7 @@ def missing_on_day(c, person, day):
     df = read_ods(ODS_FILE)
     today = get_todays_assignments(df, day, person)
     for subject in ['College Prep', 'Life Skills', 'Job Prep']:
-        if not subject in today['subject'].values:
+        if not 'Skip' in today['subject'].values and not subject in today['subject'].values:
             print(f'Missing {subject} for {person} on {day}')
 
 @task