mirror of
https://github.com/alexmickelson/canvasManagement.git
synced 2026-03-26 15:48:32 -06:00
testing negative rubric things
This commit is contained in:
@@ -43,7 +43,7 @@ export const canvasAssignmentService = {
|
||||
lock_at:
|
||||
localAssignment.lockAt &&
|
||||
getDateFromString(localAssignment.lockAt)?.toISOString(),
|
||||
points_possible: assignmentPoints(localAssignment),
|
||||
points_possible: assignmentPoints(localAssignment.rubric),
|
||||
assignment_group_id: canvasAssignmentGroupId,
|
||||
},
|
||||
};
|
||||
@@ -78,7 +78,7 @@ export const canvasAssignmentService = {
|
||||
lock_at:
|
||||
localAssignment.lockAt &&
|
||||
getDateFromString(localAssignment.lockAt)?.toISOString(),
|
||||
points_possible: assignmentPoints(localAssignment),
|
||||
points_possible: assignmentPoints(localAssignment.rubric),
|
||||
assignment_group_id: canvasAssignmentGroupId,
|
||||
},
|
||||
};
|
||||
@@ -109,7 +109,7 @@ const createRubric = async (
|
||||
localAssignment: LocalAssignment
|
||||
) => {
|
||||
const criterion = getRubricCriterion(localAssignment.rubric);
|
||||
|
||||
|
||||
const rubricBody = {
|
||||
rubric_association_id: assignmentCanvasId,
|
||||
rubric: {
|
||||
@@ -137,7 +137,7 @@ const createRubric = async (
|
||||
|
||||
const assignmentPointAdjustmentUrl = `${canvasApi}/courses/${courseId}/assignments/${assignmentCanvasId}`;
|
||||
const assignmentPointAdjustmentBody = {
|
||||
assignment: { points_possible: assignmentPoints(localAssignment) },
|
||||
assignment: { points_possible: assignmentPoints(localAssignment.rubric) },
|
||||
};
|
||||
|
||||
await axiosClient.put(
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { RubricItem } from "@/models/local/assignment/rubricItem";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { getRubricCriterion } from "./canvasRubricUtils";
|
||||
import { assignmentPoints } from "@/models/local/assignment/utils/assignmentPointsUtils";
|
||||
|
||||
describe("can prepare rubric for canvas", () =>{
|
||||
it("can parse normal rubric into criterion", () =>{
|
||||
@@ -69,4 +70,24 @@ describe("can prepare rubric for canvas", () =>{
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
it("negative rubric items do not contribute to the total", () =>{
|
||||
const rubric: RubricItem[] = [
|
||||
{
|
||||
label: "first",
|
||||
points: 1
|
||||
},
|
||||
{
|
||||
label: "second",
|
||||
points: -2
|
||||
},
|
||||
{
|
||||
label: "second",
|
||||
points: 3
|
||||
},
|
||||
]
|
||||
const points = assignmentPoints(rubric)
|
||||
expect(points).toBe(4)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user