@@ -269,7 +269,7 @@ def max_score(cls):
269
269
#: The cell type, either "code" or "markdown"
270
270
@declared_attr
271
271
def cell_type (cls ):
272
- return Column (Enum ("code" , "markdown" , name = "grade_cell_type" , validate_strings = True ), nullable = False )
272
+ return Column (Enum ("code" , "markdown" , "raw" , name = "grade_cell_type" , validate_strings = True ), nullable = False )
273
273
274
274
275
275
class GradeCell (BaseCell , GradedMixin ):
@@ -381,7 +381,7 @@ class SourceCell(Base):
381
381
name = Column (String (128 ), nullable = False )
382
382
383
383
#: The cell type, either "code" or "markdown"
384
- cell_type = Column (Enum ("code" , "markdown" , name = "source_cell_type" , validate_strings = True ), nullable = False )
384
+ cell_type = Column (Enum ("code" , "markdown" , "raw" , name = "source_cell_type" , validate_strings = True ), nullable = False )
385
385
386
386
#: Whether the cell is locked (e.g. the source saved in the database should
387
387
#: be used to overwrite the source of students' cells)
@@ -1082,7 +1082,7 @@ def __repr__(self):
1082
1082
.where (and_ (
1083
1083
Grade .notebook_id == SubmittedNotebook .id ,
1084
1084
GradeCell .id == Grade .cell_id ,
1085
- GradeCell .cell_type == "markdown" ))
1085
+ GradeCell .cell_type in ( "markdown" , "raw" ) ))
1086
1086
.correlate_except (Grade )
1087
1087
.scalar_subquery (), deferred = True )
1088
1088
@@ -1092,7 +1092,7 @@ def __repr__(self):
1092
1092
SubmittedNotebook .assignment_id == SubmittedAssignment .id ,
1093
1093
Grade .notebook_id == SubmittedNotebook .id ,
1094
1094
GradeCell .id == Grade .cell_id ,
1095
- GradeCell .cell_type == "markdown" ))
1095
+ GradeCell .cell_type in ( "markdown" , "raw" ) ))
1096
1096
.correlate_except (Grade )
1097
1097
.scalar_subquery (), deferred = True )
1098
1098
@@ -1104,7 +1104,7 @@ def __repr__(self):
1104
1104
.select_from (GradeCell )
1105
1105
.where (and_ (
1106
1106
GradeCell .notebook_id == Notebook .id ,
1107
- GradeCell .cell_type == "markdown" ))
1107
+ GradeCell .cell_type in ( "markdown" , "raw" ) ))
1108
1108
.correlate_except (GradeCell )
1109
1109
.scalar_subquery (), deferred = True )
1110
1110
@@ -1120,7 +1120,7 @@ def __repr__(self):
1120
1120
.where (and_ (
1121
1121
Notebook .assignment_id == Assignment .id ,
1122
1122
GradeCell .notebook_id == Notebook .id ,
1123
- GradeCell .cell_type == "markdown" ))
1123
+ GradeCell .cell_type in ( "markdown" , "raw" ) ))
1124
1124
.correlate_except (GradeCell )
1125
1125
.scalar_subquery (), deferred = True )
1126
1126
@@ -1193,7 +1193,7 @@ def __repr__(self):
1193
1193
.where (and_ (
1194
1194
Grade .notebook_id == SubmittedNotebook .id ,
1195
1195
TaskCell .id == Grade .cell_id ,
1196
- TaskCell .cell_type == "markdown" ))
1196
+ TaskCell .cell_type in ( "markdown" , "raw" ) ))
1197
1197
.correlate_except (Grade )
1198
1198
.scalar_subquery (), deferred = True )
1199
1199
@@ -1203,7 +1203,7 @@ def __repr__(self):
1203
1203
SubmittedNotebook .assignment_id == SubmittedAssignment .id ,
1204
1204
Grade .notebook_id == SubmittedNotebook .id ,
1205
1205
TaskCell .id == Grade .cell_id ,
1206
- TaskCell .cell_type == "markdown" ))
1206
+ TaskCell .cell_type in ( "markdown" , "raw" ) ))
1207
1207
.correlate_except (Grade )
1208
1208
.scalar_subquery (), deferred = True )
1209
1209
@@ -1215,7 +1215,7 @@ def __repr__(self):
1215
1215
.select_from (TaskCell )
1216
1216
.where (and_ (
1217
1217
TaskCell .notebook_id == Notebook .id ,
1218
- TaskCell .cell_type == "markdown" ))
1218
+ TaskCell .cell_type in ( "markdown" , "raw" ) ))
1219
1219
.correlate_except (TaskCell )
1220
1220
.scalar_subquery (), deferred = True )
1221
1221
@@ -1231,7 +1231,7 @@ def __repr__(self):
1231
1231
.where (and_ (
1232
1232
Notebook .assignment_id == Assignment .id ,
1233
1233
TaskCell .notebook_id == Notebook .id ,
1234
- TaskCell .cell_type == "markdown" ))
1234
+ TaskCell .cell_type in ( "markdown" , "raw" ) ))
1235
1235
.correlate_except (TaskCell )
1236
1236
.scalar_subquery (), deferred = True )
1237
1237
@@ -2826,7 +2826,7 @@ def average_assignment_task_score(self, assignment_id):
2826
2826
Notebook .assignment_id == Assignment .id ,
2827
2827
TaskCell .notebook_id == Notebook .id ,
2828
2828
Grade .cell_id == TaskCell .id ,
2829
- TaskCell .cell_type == "markdown" )).scalar ()
2829
+ TaskCell .cell_type in ( "markdown" , "raw" ) )).scalar ()
2830
2830
return score_sum / assignment .num_submissions
2831
2831
2832
2832
def average_notebook_score (self , notebook_id : str , assignment_id : str ) -> float :
@@ -2920,7 +2920,7 @@ def average_notebook_written_score(self, notebook_id: str, assignment_id: str) -
2920
2920
Notebook .assignment_id == Assignment .id ,
2921
2921
GradeCell .notebook_id == Notebook .id ,
2922
2922
Grade .cell_id == GradeCell .id ,
2923
- GradeCell .cell_type == "markdown" )).scalar ()
2923
+ GradeCell .cell_type in ( "markdown" , "raw" ) )).scalar ()
2924
2924
return score_sum / notebook .num_submissions
2925
2925
2926
2926
def average_notebook_task_score (self , notebook_id : str , assignment_id : str ) -> float :
@@ -2953,7 +2953,7 @@ def average_notebook_task_score(self, notebook_id: str, assignment_id: str) -> f
2953
2953
Notebook .assignment_id == Assignment .id ,
2954
2954
TaskCell .notebook_id == Notebook .id ,
2955
2955
Grade .cell_id == TaskCell .id ,
2956
- TaskCell .cell_type == "markdown" )).scalar ()
2956
+ TaskCell .cell_type in ( "markdown" , "raw" ) )).scalar ()
2957
2957
return score_sum / notebook .num_submissions
2958
2958
2959
2959
def student_dicts (self ):
@@ -3038,7 +3038,7 @@ def submission_dicts(self, assignment_id):
3038
3038
func .sum (GradeCell .max_score ).label ("max_written_score" ),
3039
3039
).select_from (SubmittedAssignment
3040
3040
).join (SubmittedNotebook ).join (Notebook ).join (Assignment ).join (Student ).join (Grade ).join (GradeCell )\
3041
- .filter (GradeCell .cell_type == "markdown" )\
3041
+ .filter (GradeCell .cell_type in ( "markdown" , "raw" ) )\
3042
3042
.group_by (SubmittedAssignment .id )\
3043
3043
.subquery ()
3044
3044
@@ -3049,7 +3049,7 @@ def submission_dicts(self, assignment_id):
3049
3049
func .sum (TaskCell .max_score ).label ("max_task_score" ),
3050
3050
).select_from (SubmittedAssignment
3051
3051
).join (SubmittedNotebook ).join (Notebook ).join (Assignment ).join (Student ).join (Grade ).join (TaskCell )\
3052
- .filter (TaskCell .cell_type == "markdown" )\
3052
+ .filter (TaskCell .cell_type in ( "markdown" , "raw" ) )\
3053
3053
.group_by (SubmittedAssignment .id )\
3054
3054
.subquery ()
3055
3055
@@ -3082,7 +3082,7 @@ def submission_dicts(self, assignment_id):
3082
3082
func .sum (GradeCell .max_score ).label ("max_score" ),
3083
3083
).select_from (SubmittedAssignment
3084
3084
).join (SubmittedNotebook ).join (Grade ).join (GradeCell )\
3085
- .filter (GradeCell .cell_type == "markdown" )\
3085
+ .filter (GradeCell .cell_type in ( "markdown" , "raw" ) )\
3086
3086
.group_by (SubmittedAssignment .id ),
3087
3087
3088
3088
self .db .query (
@@ -3091,7 +3091,7 @@ def submission_dicts(self, assignment_id):
3091
3091
func .sum (TaskCell .max_score ).label ("max_score" ),
3092
3092
).select_from (SubmittedAssignment
3093
3093
).join (SubmittedNotebook ).join (Grade ).join (TaskCell )\
3094
- .filter (TaskCell .cell_type == "markdown" )\
3094
+ .filter (TaskCell .cell_type in ( "markdown" , "raw" ) )\
3095
3095
.group_by (SubmittedAssignment .id )
3096
3096
).subquery ()
3097
3097
@@ -3186,7 +3186,7 @@ def notebook_submission_dicts(self, notebook_id, assignment_id):
3186
3186
func .sum (GradeCell .max_score ).label ("max_written_score" ),
3187
3187
).select_from (SubmittedNotebook
3188
3188
).join (SubmittedAssignment ).join (Notebook ).join (Assignment ).join (Student ).join (Grade ).join (GradeCell )\
3189
- .filter (GradeCell .cell_type == "markdown" )\
3189
+ .filter (GradeCell .cell_type in ( "markdown" , "raw" ) )\
3190
3190
.group_by (SubmittedNotebook .id )\
3191
3191
.subquery ()
3192
3192
# subquery for the written scores
@@ -3196,7 +3196,7 @@ def notebook_submission_dicts(self, notebook_id, assignment_id):
3196
3196
func .sum (TaskCell .max_score ).label ("max_task_score" ),
3197
3197
).select_from (SubmittedNotebook
3198
3198
).join (SubmittedAssignment ).join (Notebook ).join (Assignment ).join (Student ).join (Grade ).join (TaskCell )\
3199
- .filter (TaskCell .cell_type == "markdown" )\
3199
+ .filter (TaskCell .cell_type in ( "markdown" , "raw" ) )\
3200
3200
.group_by (SubmittedNotebook .id )\
3201
3201
.subquery ()
3202
3202
@@ -3224,7 +3224,7 @@ def notebook_submission_dicts(self, notebook_id, assignment_id):
3224
3224
func .sum (GradeCell .max_score ).label ("max_score" ),
3225
3225
).select_from (SubmittedNotebook
3226
3226
).join (Grade ).join (GradeCell )\
3227
- .filter (GradeCell .cell_type == "markdown" )\
3227
+ .filter (GradeCell .cell_type in ( "markdown" , "raw" ) )\
3228
3228
.group_by (SubmittedNotebook .id ),
3229
3229
3230
3230
self .db .query (
@@ -3233,7 +3233,7 @@ def notebook_submission_dicts(self, notebook_id, assignment_id):
3233
3233
func .sum (TaskCell .max_score ).label ("max_score" ),
3234
3234
).select_from (SubmittedNotebook
3235
3235
).join (Grade ).join (TaskCell )\
3236
- .filter (TaskCell .cell_type == "markdown" )\
3236
+ .filter (TaskCell .cell_type in ( "markdown" , "raw" ) )\
3237
3237
.group_by (SubmittedNotebook .id )
3238
3238
).subquery ()
3239
3239
0 commit comments