Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 3 additions & 17 deletions core/apps/assignment/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
QuestionPool,
Rubric,
RubricCriterion,
Solution,
Submission,
)
from apps.common.admin import (
Expand All @@ -43,22 +42,12 @@ class QuestionInline(TabularInline[Question]):

@admin.register(Question)
class QuestionAdmin(HiddenModelAdmin[Question]):
class SolutionInline(TabularInline[Solution]):
model = Solution

inlines = (SolutionInline,)

def formfield_for_dbfield(self, db_field, request, **kwargs: object):
if db_field.name == "supplement":
kwargs["widget"] = WysiwygWidget()
return super().formfield_for_dbfield(db_field, request, **kwargs)


@admin.register(Solution)
class SolutionAdmin(HiddenModelAdmin[Solution]):
pass


@admin.register(Rubric)
class RubricAdmin(ModelAdmin[Rubric]):
class RubricCriterionInline(TabularInline[RubricCriterion]):
Expand Down Expand Up @@ -158,14 +147,11 @@ class GradeEventInline(ReadOnlyTabularInline[Grade.pgh_event_model]):

@action(description=_("Grade"), permissions=["grade"]) # type: ignore # gettext not working
def grade(self, request: HttpRequest, obj: Grade):
grade = Grade.objects.select_related("attempt__assignment", "attempt__question__solution__rubric").get(
pk=obj.pk
)
grade = Grade.objects.select_related("attempt__assignment", "attempt__question").get(pk=obj.pk)
prefetch_related_objects(
[grade.attempt],
[grade.attempt.assignment],
Prefetch(
"question__solution__rubric__rubric_criteria__performance_levels",
queryset=PerformanceLevel.objects.order_by("point"),
"rubric__rubric_criteria__performance_levels", queryset=PerformanceLevel.objects.order_by("point")
),
)
async_to_sync(grade.grade)(grader_id=cast(str, request.user.pk) if request.user else None)
Expand Down
10 changes: 2 additions & 8 deletions core/apps/assignment/api/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ class AssignmentSchema(LearningObjectMixinSchema):
id: str
owner: OwnerSchema
honor_code: HonorCodeSchema
rubric_data: RubricSchema | None
sample_attachment: str | None


class AssignmentSubmissionSchema(TimeStampedMixinSchema):
Expand All @@ -39,9 +41,7 @@ class AssignmentQuestionSchema(Schema):
supplement: str
attachment_file_count: int
attachment_file_types: list[str]
sample_attachment: str | None
plagiarism_threshold: int
solution: "AssignmentSolutionSchema"

@staticmethod
def resolve_supplement(obj: Question):
Expand All @@ -58,12 +58,6 @@ class AssignmentGradeSchema(GradeFieldMixinSchema, TimeStampedMixinSchema):
id: int


class AssignmentSolutionSchema(Schema):
id: int
rubric_data: "RubricSchema"
explanation: str


class RubricSchema(Schema):
name: str
description: str
Expand Down
167 changes: 167 additions & 0 deletions core/apps/assignment/fixtures/generic_rubric_en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
[
{
"model": "assignment.rubric",
"pk": 1,
"fields": {
"name": "General Rubric",
"description": "A general-purpose rubric for evaluating assignments."
}
},
{
"model": "assignment.rubriccriterion",
"pk": 1,
"fields": {
"rubric": 1,
"name": "Content",
"description": "Evaluates the accuracy, relevance, and depth of the content."
}
},
{
"model": "assignment.rubriccriterion",
"pk": 2,
"fields": {
"rubric": 1,
"name": "Organization",
"description": "Evaluates the logical structure and flow of the response."
}
},
{
"model": "assignment.rubriccriterion",
"pk": 3,
"fields": {
"rubric": 1,
"name": "Expression",
"description": "Evaluates clarity, grammar, and overall quality of writing."
}
},
{
"model": "assignment.performancelevel",
"pk": 1,
"fields": {
"criterion": 1,
"name": "Poor",
"description": "Content is largely inaccurate, irrelevant, or missing.",
"point": 1
}
},
{
"model": "assignment.performancelevel",
"pk": 2,
"fields": {
"criterion": 1,
"name": "Developing",
"description": "Content is partially accurate but lacks depth or relevance.",
"point": 2
}
},
{
"model": "assignment.performancelevel",
"pk": 3,
"fields": {
"criterion": 1,
"name": "Proficient",
"description": "Content is mostly accurate and relevant with adequate depth.",
"point": 3
}
},
{
"model": "assignment.performancelevel",
"pk": 4,
"fields": {
"criterion": 1,
"name": "Excellent",
"description": "Content is accurate, highly relevant, and demonstrates strong depth.",
"point": 4
}
},
{
"model": "assignment.performancelevel",
"pk": 5,
"fields": {
"criterion": 2,
"name": "Poor",
"description": "Response lacks clear structure and is difficult to follow.",
"point": 1
}
},
{
"model": "assignment.performancelevel",
"pk": 6,
"fields": {
"criterion": 2,
"name": "Developing",
"description": "Some structure is present but transitions and flow are inconsistent.",
"point": 2
}
},
{
"model": "assignment.performancelevel",
"pk": 7,
"fields": {
"criterion": 2,
"name": "Proficient",
"description": "Response is well-organized with clear transitions.",
"point": 3
}
},
{
"model": "assignment.performancelevel",
"pk": 8,
"fields": {
"criterion": 2,
"name": "Excellent",
"description": "Response is exceptionally well-structured and easy to follow.",
"point": 4
}
},
{
"model": "assignment.performancelevel",
"pk": 9,
"fields": {
"criterion": 3,
"name": "Poor",
"description": "Writing is unclear with frequent grammatical errors.",
"point": 1
}
},
{
"model": "assignment.performancelevel",
"pk": 10,
"fields": {
"criterion": 3,
"name": "Developing",
"description": "Writing is somewhat clear but has noticeable errors.",
"point": 2
}
},
{
"model": "assignment.performancelevel",
"pk": 11,
"fields": {
"criterion": 3,
"name": "Proficient",
"description": "Writing is clear and mostly free of grammatical errors.",
"point": 3
}
},
{
"model": "assignment.performancelevel",
"pk": 12,
"fields": {
"criterion": 3,
"name": "Excellent",
"description": "Writing is exceptionally clear, polished, and error-free.",
"point": 4
}
},
{
"model": "assignment.performancelevel",
"pk": 13,
"fields": {
"criterion": 3,
"name": "Outstanding",
"description": "Writing demonstrates exceptional style, precision, and sophistication.",
"point": 5
}
}
]
Loading