Skip to content

Commit

Permalink
Renames
Browse files Browse the repository at this point in the history
  • Loading branch information
nygrenh committed Jul 20, 2023
1 parent 9dd92f1 commit eb8388f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion services/headless-lms/models/src/course_instances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ WHERE id IN (SELECT * FROM UNNEST($1::uuid[]))
}

/// Deletes submissions, peer reviews, points and etc. for a course and user. Main purpose is for teachers who are testing their course with their own accounts.
pub async fn reset_course_instance_for_user(
pub async fn reset_progress_on_course_instance_for_user(
conn: &mut PgConnection,
user_id: Uuid,
course_instance_id: Uuid,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1145,12 +1145,12 @@ pub async fn get_page_visit_datum_summary_by_countries(
}

/**
DELETE `/api/v0/main-frontend/courses/${course.id}/teacher-reset-course-for-themselves` - Allows a teacher to reset a course for themselves. Cannot be used to reset the course for others.
DELETE `/api/v0/main-frontend/courses/${course.id}/teacher-reset-course-progress-for-themselves` - Allows a teacher to reset the course progress for themselves. Cannot be used to reset the course for others.
Deletes submissions, user exercise states, and peer reviews etc. for all the course instances of this course.
*/
#[generated_doc]
pub async fn teacher_reset_course_for_themselves(
pub async fn teacher_reset_course_progress_for_themselves(
course_id: web::Path<Uuid>,
pool: web::Data<PgPool>,
user: AuthUser,
Expand All @@ -1163,7 +1163,7 @@ pub async fn teacher_reset_course_for_themselves(
let course_instances =
models::course_instances::get_course_instances_for_course(&mut tx, course_id).await?;
for course_instance in course_instances {
models::course_instances::reset_course_instance_for_user(
models::course_instances::reset_progress_on_course_instance_for_user(
&mut tx,
user.id,
course_instance.id,
Expand Down Expand Up @@ -1317,7 +1317,7 @@ pub fn _add_routes(cfg: &mut ServiceConfig) {
web::get().to(get_page_visit_datum_summary_by_countries),
)
.route(
"/{course_id}/teacher-reset-course-for-themselves",
web::delete().to(teacher_reset_course_for_themselves),
"/{course_id}/teacher-reset-course-progress-for-themselves",
web::delete().to(teacher_reset_course_progress_for_themselves),
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useTranslation } from "react-i18next"
import useCourseBreadcrumbInfoQuery from "../../../../../../hooks/useCourseBreadcrumbInfoQuery"
import {
deleteCourse,
teacherResetCourseForThemselves,
teacherResetCourseProgressForThemselves,
} from "../../../../../../services/backend/courses"
import { Course } from "../../../../../../shared-module/bindings"
import Button from "../../../../../../shared-module/components/Button"
Expand Down Expand Up @@ -48,9 +48,9 @@ const ManageCourse: React.FC<React.PropsWithChildren<Props>> = ({ course, refetc
},
)

const teacherResetCourseForThemselvesMutation = useToastMutation(
const teacherResetCourseProgressForThemselvesMutation = useToastMutation(
async () => {
await teacherResetCourseForThemselves(course.id)
await teacherResetCourseProgressForThemselves(course.id)
},
{
notify: true,
Expand Down Expand Up @@ -181,7 +181,7 @@ const ManageCourse: React.FC<React.PropsWithChildren<Props>> = ({ course, refetc
t("are-you-sure-you-want-to-reset-your-own-progress-on-the-course"),
)
if (sure) {
teacherResetCourseForThemselvesMutation.mutate()
teacherResetCourseProgressForThemselvesMutation.mutate()
}
}}
>
Expand Down
6 changes: 4 additions & 2 deletions services/main-frontend/src/services/backend/courses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,10 @@ export const postNewPageOrdering = async (courseId: string, pages: Page[]): Prom
}

/** Teacher can use this to delete their own submissions, points, etc but they cannot use it to delete those things for other users */
export const teacherResetCourseForThemselves = async (courseId: string): Promise<void> => {
await mainFrontendClient.delete(`/courses/${courseId}/teacher-reset-course-for-themselves`)
export const teacherResetCourseProgressForThemselves = async (courseId: string): Promise<void> => {
await mainFrontendClient.delete(
`/courses/${courseId}/teacher-reset-course-progress-for-themselves`,
)
}

export const postNewChapterOrdering = async (
Expand Down
4 changes: 2 additions & 2 deletions shared-module/src/locales/en/course-material.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
"n-characters-over-limit": "{{n}} characters over the limit",
"no-comments-yet": "No comments yet",
"no-submission-received-for-this-exercise": "No submission received for this exercise.",
"number-of-student": "Number of student",
"opens-in-time": "Opens in {{ relative-time }}",
"opens-now": "Opens now!",
"peer-review": "Peer review",
Expand All @@ -115,6 +116,7 @@
"please-wait-until-next-chapter-opens": "Please wait until the next chapter opens.",
"points-label": "Points",
"points-required-for-completion": "Points required for completion",
"popular-regions": "Popular Countries",
"preview": "Preview",
"preview-changes-or-make-more-edits": "Preview your changes or make more edits",
"proceed-to-next-topic": "Proceed to the next topic",
Expand Down Expand Up @@ -172,7 +174,5 @@
"you-have-completed-the-course-to-receive-certificate-use-following-links": "You have successfully completed the course! You can use the following links to generate your certificate.",
"you-have-completed-the-course-to-receive-credits-or-certificate-use-following-links": "You have successfully completed the course! To receive ECTS credits for your completions, you can use the following links to register your completion and receive a certificate.",
"youve-made-changes": "You've made changes",
"popular-regions": "Popular Countries",
"number-of-student": "Number of student",
"youve-selected-material-for-editing": "You've selected material for editing"
}

0 comments on commit eb8388f

Please sign in to comment.