From 76744ae0f53521fc3ae7a6344dddee830e9f86b1 Mon Sep 17 00:00:00 2001
From: janmax <mail-github@jmx.io>
Date: Thu, 13 Apr 2017 01:17:35 +0000
Subject: [PATCH] Added some docs to the models.py file

---
 .gitignore     |  3 +++
 core/models.py | 63 +++++++++++++++++++++++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 6 deletions(-)

diff --git a/.gitignore b/.gitignore
index a5c4f26b..5e408470 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,6 @@ klausur_*
 
 # operation system
 .DS_Store
+
+# sublime specific
+*.sublime-*
diff --git a/core/models.py b/core/models.py
index de6d392e..1d19933a 100644
--- a/core/models.py
+++ b/core/models.py
@@ -1,3 +1,48 @@
+################################################################################
+# Grady Model Description
+# -----------------------
+#
+# Currently Grady incorporates four models on top of the existing django models
+# like User and Group. The fields should be self explanatory.
+#
+# SubmissionType
+# --------------
+#
+# This model mostly holds meta information about the kind of task that was
+# presented to the student. It serves as a foreign key for the submissions that
+# are of this type. This model is currently NOT exposed directly in a view.
+#
+# Student
+# -------
+#
+# Mostly wraps a User model and adds some data to it describing the user account
+#
+# Submission
+# ----------
+#
+# This table holds the basic information about a submission of a student
+# including all kinds of processed information, like compiler output, etc.
+#
+# With the method assign_tutor feedback for a submission can be created and a
+# tutor will be assigned to this feedback permanently (unless deleted by a
+# reviewer or if it gets reassigned). There cannot be more than ONE feedback per
+# Submission.
+#
+# Feedback
+# --------
+#
+# Feedback is the most complicated model. It holds
+# information about origin, and status of the current feedback, as well as
+# tutor annotations that may not be visible to students. Several methods control
+# how feedback is passed along between tutors.
+#
+# For details on these methods see below.
+#
+################################################################################
+
+
+
+
 from random import sample, randrange
 from string import ascii_lowercase
 
@@ -18,7 +63,6 @@ def random_matrikel_no():
 
 
 class SubmissionType(models.Model):
-
     # Fields
     name = models.CharField(max_length=50, unique=True)
     slug = models.SlugField(editable=False, unique=True, default=random_slug)
@@ -36,7 +80,6 @@ class SubmissionType(models.Model):
 
 
 class Student(models.Model):
-
     # Fields
     matrikel_no = models.CharField(
         unique=True, max_length=8, default=random_matrikel_no)
@@ -101,8 +144,8 @@ class Submission(models.Model):
         Returns:
             True if something was assigned, false if not
         """
-        # Get a submission from the submission set
 
+        # Get a submission from the submission set
         unfinished = Feedback.tutor_unfinished_feedback(tutor)
         if unfinished:
             return False
@@ -221,7 +264,7 @@ class Feedback(models.Model):
         return tutor_feedback[0] if tutor_feedback else None
 
     def tutor_assigned_feedback(cls, user):
-        """Gets all feedback that is assigned to the tutor inculuding
+        """ Gets all feedback that is assigned to the tutor including
         all status cases.
 
         Returns:
@@ -245,16 +288,24 @@ class Feedback(models.Model):
         self.save()
 
     def unfinalize_feedback(self):
-        """ Used to mark feedback as accepted (reviewed)
+        """Used to mark feedback as accepted (reviewed)
 
-        This makes it uneditable by the tutor
+        This makes it uneditable by the tutor.
         """
+
         self.origin = Feedback.MANUAL
         self.of_reviewer = None
         self.of_submission.final_feedback = None
         self.save()
 
     def reassign_to_tutor(self, user):
+        """ When a tutor does not want to correct some task they can pass it
+        along to another tutor who will accept the request.
+
+        Args:
+            user: The user to which to feedback should be assigned to
+        """
+        assert self.status == Feedback.OPEN
         self.of_tutor = user
         self.status = Feedback.EDITABLE
         self.save()
-- 
GitLab