redkyn / assigner

:black_nib: Automatically assign programming homework to students on GitLab.
MIT License
27 stars 6 forks source link

`assigner score` can't handle missing repos/students #154

Closed BehindTheBrain closed 3 years ago

BehindTheBrain commented 4 years ago

If a student has failed to create/initialize a Gitlab account and we try to:

assigner score all
...
INFO     Scoring 2020-FS-CS1500/2020-FS-A-pa00-environment-studentname...
WARNING  Did not find any users matching studentname.
WARNING  Unable to find repo for studentname with URL 2020-FS-A-pa00-environment-studentname
ERROR    local variable 'score' referenced before assignment
BehindTheBrain commented 4 years ago

I'm pretty sure this is sufficient:

diff --git a/assigner/commands/score.py b/assigner/commands/score.py
index 9c43d2c..0383cb5 100644
--- a/assigner/commands/score.py
+++ b/assigner/commands/score.py
@@ -299,6 +299,7 @@ def handle_scoring(
     except RepoError as e:
         logger.debug(e)
         logger.warning("Unable to find repo for %s with URL %s", username, full_name)
+        score = None
     return score
...
BehindTheBrain commented 4 years ago

Basic testing works on this change.