worksheet-grading 1.4.2__tar.gz → 1.4.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/PKG-INFO +1 -1
  2. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/__init__.py +2 -2
  3. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/grade.py +29 -6
  4. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading.egg-info/PKG-INFO +1 -1
  5. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/LICENSE +0 -0
  6. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/README.md +0 -0
  7. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/setup.cfg +0 -0
  8. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/setup.py +0 -0
  9. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/config.py +0 -0
  10. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/grade_export.py +0 -0
  11. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/grade_import.py +0 -0
  12. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/gradelib.py +0 -0
  13. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/moodle_util.py +0 -0
  14. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/split.py +0 -0
  15. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading/util.py +0 -0
  16. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading.egg-info/SOURCES.txt +0 -0
  17. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading.egg-info/dependency_links.txt +0 -0
  18. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading.egg-info/entry_points.txt +0 -0
  19. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading.egg-info/requires.txt +0 -0
  20. {worksheet_grading-1.4.2 → worksheet_grading-1.4.4}/worksheet_grading.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: worksheet_grading
3
- Version: 1.4.2
3
+ Version: 1.4.4
4
4
  Summary: Exercise sheet grading utility with Moodle support
5
5
  Home-page: https://gitlab.com/kdvkrs/worksheet_grading
6
6
  Author: Klaus Kraßnitzer
@@ -1,6 +1,6 @@
1
1
  __author__ = "Klaus Kraßnitzer"
2
- __copyright__ = "Copyright (C) 2022 " + __author__
3
- __version__ = "1.4.2"
2
+ __copyright__ = "Copyright (C) 2023 " + __author__
3
+ __version__ = "1.4.4"
4
4
  __license__ = "Distributed under the MIT License: <https://mit-license.org/>"
5
5
  __program__ = "Worksheet Grading Script"
6
6
  __package__ = "worksheet-grading"
@@ -5,6 +5,7 @@ import argparse
5
5
  import webbrowser
6
6
  import subprocess
7
7
  import statistics
8
+ from collections import defaultdict
8
9
 
9
10
  # external imports
10
11
  import readchar
@@ -114,7 +115,20 @@ def handle_action(state: State, actions, message, prompt_string=None):
114
115
 
115
116
  def menu(frame: Frame):
116
117
  while True:
117
- message = "\n" + bright(light_blue("{} V{}".format(__program__, __version__))) + "\n\n"
118
+ message = ""
119
+ # partially graded exercises
120
+ pg_exc = partially_graded_exercises(frame)
121
+ # show partially graded exercises
122
+ if len(pg_exc) > 0:
123
+ warn = lambda t: bright(red(t))
124
+ num_pg = sum(len(e) for e in pg_exc.values())
125
+ message += warn(f"There {'are' if num_pg > 1 else 'is'} {num_pg} partially graded {'exercises' if num_pg > 1 else 'exercise'} the grading state of which will be lost if not graded before exit!\n")
126
+ message += warn("Partially graded exercises:\n")
127
+ for e in pg_exc:
128
+ message += red(f"\t{e}: {pg_exc[e]}\n")
129
+
130
+
131
+ message += "\n" + bright(light_blue("{} V{}".format(__program__, __version__))) + "\n\n"
118
132
  message += group_overview(frame)
119
133
  actions = [
120
134
  ("g", "Quick Grade", act_quick_grade),
@@ -745,7 +759,7 @@ def act_sanity_check(state: State):
745
759
  for e in state.frame.data.values():
746
760
  for ex in e.sheet.exercises.values():
747
761
  for a in ex.answers:
748
- if a.deductions.deducted_points() < -1 * points[ex.number][a.num - 1]:
762
+ if a.deductions.deducted_points() < -1 * points[ex.number][a.num-1]:
749
763
  print(red("Invalid deduction found for group \"{}\" exercise {}.{}").format(e.group,
750
764
  ex.number, a.num))
751
765
  sane = False
@@ -755,14 +769,14 @@ def act_sanity_check(state: State):
755
769
  print(red("Invalid deductions found, see above output"))
756
770
  else:
757
771
  print(green("No invalid deductions found"))
758
-
772
+
759
773
 
760
774
  def act_statistics(state: State):
761
775
  stat_frame = state.frame.csv_df
762
776
  groups = state.frame.data.keys()
763
777
  stat_pts = []
764
778
  for g in groups:
765
- if state.frame.data[g].sheet.grade_status() == config.GRADED:
779
+ if state.frame.data[g].sheet.grade_status() == GradeStatus.GRADED:
766
780
  stat_pts.append(stat_frame[stat_frame.group == g]["points"].sum())
767
781
 
768
782
  try:
@@ -793,13 +807,22 @@ def reset_max_lens():
793
807
 
794
808
  # Points for sanity check
795
809
  def sc_points():
796
- points = []
810
+ points = {}
797
811
  for i in config.DEFAULT_MASK:
798
812
  exc = config.EXERCISES.get(str(i))
799
813
  if exc is not None:
800
- points.append(exc)
814
+ points[i] = exc
801
815
  return points
802
816
 
817
+
818
+ def partially_graded_exercises(frame: Frame):
819
+ pg_exc = defaultdict(list)
820
+ for e in frame.data.values():
821
+ for ex in e.sheet.exercises.values():
822
+ if ex.grade_status == GradeStatus.PARTIALLY_GRADED:
823
+ pg_exc[e.group].append(ex.number)
824
+ return pg_exc
825
+
803
826
  # ========== MAIN ========== #
804
827
 
805
828
  def main():
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: worksheet-grading
3
- Version: 1.4.2
3
+ Version: 1.4.4
4
4
  Summary: Exercise sheet grading utility with Moodle support
5
5
  Home-page: https://gitlab.com/kdvkrs/worksheet_grading
6
6
  Author: Klaus Kraßnitzer