Skip to content

Commit

Permalink
Migration
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Jan 9, 2024
1 parent 5fcab64 commit 9f322d9
Show file tree
Hide file tree
Showing 32 changed files with 137 additions and 116 deletions.
16 changes: 8 additions & 8 deletions services/cms/src/components/PeerReviewEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getCoursesDefaultCmsPeerReviewConfiguration } from "../services/backend
import {
CmsPeerReviewConfig,
CmsPeerReviewQuestion,
PeerReviewAcceptingStrategy,
PeerReviewProcessingStrategy,
PeerReviewQuestion,
PeerReviewQuestionType,
} from "../shared-module/bindings"
Expand Down Expand Up @@ -156,17 +156,17 @@ const PeerReviewEditor: React.FC<PeerReviewEditorProps> = ({
{ label: t("likert-scale"), value: "Scale" },
]

const peerReviewAcceptingStrategyOptions: {
const PeerReviewProcessingStrategyOptions: {
label: string
value: PeerReviewAcceptingStrategy
value: PeerReviewProcessingStrategy
}[] = [
{
label: "Automatically accept or reject by average",
value: "AutomaticallyAcceptOrRejectByAverage",
value: "AutomaticallyGradeByAverage",
},
{
label: "Automatically accept or manual review by average",
value: "AutomaticallyAcceptOrManualReviewByAverage",
value: "AutomaticallyGradeOrManualReviewByAverage",
},
{
label: "Manual review everything",
Expand Down Expand Up @@ -235,7 +235,7 @@ const PeerReviewEditor: React.FC<PeerReviewEditorProps> = ({
id: v4(),
course_id: courseId,
exercise_id: exerciseId ?? null,
accepting_strategy: "AutomaticallyAcceptOrManualReviewByAverage",
accepting_strategy: "AutomaticallyGradeOrManualReviewByAverage",
accepting_threshold: 2.1,
peer_reviews_to_give: 3,
peer_reviews_to_receive: 2,
Expand Down Expand Up @@ -390,7 +390,7 @@ const PeerReviewEditor: React.FC<PeerReviewEditorProps> = ({
onChangeByValue={(value) => {
handlePeerReviewValueChange(value, "accepting_strategy")
}}
options={peerReviewAcceptingStrategyOptions}
options={PeerReviewProcessingStrategyOptions}
defaultValue={parsedPeerReviewConfig.accepting_strategy}
/>
<TextField
Expand Down Expand Up @@ -488,7 +488,7 @@ function defaultPeerReviewConfig(
id: v4(),
exercise_id: exerciseId ? exerciseId : null,
course_id: courseId,
accepting_strategy: "AutomaticallyAcceptOrManualReviewByAverage",
accepting_strategy: "AutomaticallyGradeOrManualReviewByAverage",
accepting_threshold: 2.1,
peer_reviews_to_give: 3,
peer_reviews_to_receive: 2,
Expand Down
4 changes: 2 additions & 2 deletions services/cms/tests/utils/documentSchemaProcessor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const exampleCMSPageUpdate: CmsPageUpdate = {
id: "f0ae5814-927d-4a38-a0c0-db66f08c2bee",
course_id: "",
exercise_id: "dd46fb67-d168-4554-b912-0018f812166d",
accepting_strategy: "AutomaticallyAcceptOrManualReviewByAverage",
accepting_strategy: "AutomaticallyGradeOrManualReviewByAverage",
accepting_threshold: 0.5,
peer_reviews_to_give: 1,
peer_reviews_to_receive: 1,
Expand Down Expand Up @@ -129,7 +129,7 @@ const exampleUnnormalizedDocumentExerciseAttributes: ExerciseAttributes = {
limit_number_of_tries: true,
needs_peer_review: true,
peer_review_config:
'[{"id":"f0ae5814-927d-4a38-a0c0-db66f08c2bee","course_id":"","exercise_id":"dd46fb67-d168-4554-b912-0018f812166d","accepting_strategy":"AutomaticallyAcceptOrManualReviewByAverage","accepting_threshold":"0.5","peer_reviews_to_give":"1","peer_reviews_to_receive":"1"}]',
'[{"id":"f0ae5814-927d-4a38-a0c0-db66f08c2bee","course_id":"","exercise_id":"dd46fb67-d168-4554-b912-0018f812166d","accepting_strategy":"AutomaticallyGradeOrManualReviewByAverage","accepting_threshold":"0.5","peer_reviews_to_give":"1","peer_reviews_to_receive":"1"}]',
peer_review_questions_config:
'[{"id":"f3c8eadd-75ca-409f-b1c6-31db65701930","peer_review_config_id":"f0ae5814-927d-4a38-a0c0-db66f08c2bee","answer_required":"true","order_number":"0","question":"how about...","question_type":"Essay"}]',
use_course_default_peer_review: false,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
ALTER TABLE peer_review_configs DROP COLUMN points_are_all_or_nothing;
ALTER TABLE peer_review_questions DROP COLUMN weight;
ALTER TYPE peer_review_processing_strategy
RENAME TO peer_review_accepting_strategy;
ALTER TYPE peer_review_accepting_strategy
RENAME VALUE 'automatically_grade_by_average' TO 'automatically_accept_or_reject_by_average';
ALTER TYPE peer_review_accepting_strategy
RENAME VALUE 'automatically_grade_or_manual_review_by_average' TO 'automatically_accept_or_manual_review_by_average';
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ALTER TABLE peer_review_configs
ADD COLUMN points_are_all_or_nothing BOOLEAN NOT NULL DEFAULT TRUE;
COMMENT ON COLUMN peer_review_configs.points_are_all_or_nothing IS 'True by default and recommended to keep it that way for most courses. If set to true, the student will always receive either full points or no points from the peer reviewed exercise. If set to false, the points will be weighted according to a weight in each peer review question.';
ALTER TABLE peer_review_questions
ADD COLUMN weight INTEGER NOT NULL DEFAULT 1;
COMMENT ON COLUMN peer_review_questions.weight IS 'The weight of the question in the peer review. The weight is used to calculate the points the student receives from the peer review. The points are calculated by multiplying the weight of the question with the points the student gave to the answer. The points are then summed up and divided by the sum of the weights of all questions in the peer review. The result is rounded to the nearest integer.';
ALTER TYPE peer_review_accepting_strategy
RENAME TO peer_review_processing_strategy;
ALTER TYPE peer_review_processing_strategy
RENAME VALUE 'automatically_accept_or_reject_by_average' TO 'automatically_grade_by_average';
ALTER TYPE peer_review_processing_strategy
RENAME VALUE 'automatically_accept_or_manual_review_by_average' TO 'automatically_grade_or_manual_review_by_average';
COMMENT ON COLUMN peer_review_configs.accepting_threshold IS 'The threshold on the average review received for "passing" a peer reviewed exercise. If points_are_all_or_nothing is true, this threshold tells whether to give full points or zero points. If points_are_all_or_nothing is false and peer_review_processing_strategy is automatically_grade_or_manual_review_by average all averages under this threshold will cause an answer to be sent to manual review. In all other cases, this column will be ignored. Peer review questions are on a scale from 1 to 5.';

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions services/headless-lms/models/src/library/grading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{
exercise_task_submissions::{self, ExerciseTaskSubmission},
exercise_tasks::{self, CourseMaterialExerciseTask, ExerciseTask},
exercises::{self, Exercise, ExerciseStatus, GradingProgress},
peer_review_configs::PeerReviewAcceptingStrategy,
peer_review_configs::PeerReviewProcessingStrategy,
peer_review_question_submissions::{
self, PeerReviewQuestionSubmission, PeerReviewWithQuestionsAndAnswers,
},
Expand Down Expand Up @@ -94,9 +94,9 @@ pub struct ExerciseSlideSubmissionWithTasks {
pub struct ExerciseStateUpdateNeedToUpdatePeerReviewStatusWithThis {
pub given_enough_peer_reviews: bool,
pub received_enough_peer_reviews: bool,
pub peer_review_accepting_strategy: PeerReviewAcceptingStrategy,
pub peer_review_processing_strategy: PeerReviewProcessingStrategy,
pub peer_review_accepting_threshold: f32,
/// Used to for calculating averages when acting on PeerReviewAcceptingStrategy
/// Used to for calculating averages when acting on PeerReviewProcessingStrategy
pub received_peer_review_question_submissions: Vec<PeerReviewQuestionSubmission>,
}

Expand Down
Loading

0 comments on commit 9f322d9

Please sign in to comment.