Richard Lawrence committed 3e37342

* grading/, select grade validator based on assignment grade_type

Comments (0)

Files changed (2)


                        year=None, semester=None, name=None):
     """Return a result set of assignments.
        The rows in the result set have the format:
-       (assignment_id, course_id, assignment_name, due_date)
+       (assignment_id, course_id, assignment_name, due_date, grade_type, weight,
+         description)
     base_query = """
-    SELECT,,, assignments.due_date
+    SELECT,,, assignments.due_date,
+           assignments.grade_type, assignments.weight, assignments.description
     FROM assignments, courses


         """Enter grades.
            Enter grades for the current assignment for individual students.
-        # TODO: select grade validator based on assignment type
-        # _, __, = select_assignments(self.db_connection, assignment_id=self.assignment_id)
+        grade_type = db.select_assignments(self.db_connection,
+                                           assignment_id=self.assignment_id)[0][4]
+        grade_validator = validators.validator_for_grade_type(grade_type)
         print ""
         print "Use Control-C to finish entering grades."
         while True:
                 student_id, last_name, first_name, sid, _ = self.get_student()
                 grade_id = None
-                grade_val = typed_input("Enter grade value: ", str)
+                grade_val = typed_input("Enter grade value: ", grade_validator)
                 existing_grades = db.select_grades(self.db_connection,
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.