Every REST response returns `id`-field as string
This commit is contained in:
parent
49a3fa99e1
commit
dcf450339d
|
|
@ -1,60 +0,0 @@
|
|||
import dayjs from "dayjs";
|
||||
|
||||
export const dueDatesTestData = () => {
|
||||
return [
|
||||
{
|
||||
id: 1,
|
||||
start: dayjs("2023-06-14T15:00:00+02:00"),
|
||||
end: dayjs("2023-06-14T18:00:00+02:00"),
|
||||
title: "Präsenzkurs Kickoff",
|
||||
url: "/course/überbetriebliche-kurse/learn/kickoff/präsenzkurs-kickoff",
|
||||
course_session: 2,
|
||||
page: 383,
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
start: dayjs("2023-06-15T15:00:00+02:00"),
|
||||
end: dayjs("2023-06-15T18:00:00+02:00"),
|
||||
title: "Präsenzkurs Basis",
|
||||
url: "/course/überbetriebliche-kurse/learn/basis/präsenzkurs-basis",
|
||||
course_session: 2,
|
||||
page: 397,
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
start: dayjs("2023-06-16T15:00:00+02:00"),
|
||||
end: dayjs("2023-06-16T18:00:00+02:00"),
|
||||
title: "Präsenzkurs Fahrzeug",
|
||||
url: "/course/überbetriebliche-kurse/learn/fahrzeug/präsenzkurs-fahrzeug",
|
||||
course_session: 2,
|
||||
page: 413,
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
start: dayjs("2023-06-16T15:00:00+02:00"),
|
||||
end: dayjs("2023-06-16T18:00:00+02:00"),
|
||||
title: "Präsenzkurs Flugzeuge",
|
||||
url: "/course/überbetriebliche-kurse/learn/fahrzeug/präsenzkurs-fahrzeug",
|
||||
course_session: 2,
|
||||
page: 413,
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
start: dayjs("2023-07-16T11:00:00+02:00"),
|
||||
end: dayjs("2023-07-16T18:00:00+02:00"),
|
||||
title: "Präsenzkurs Motorräder",
|
||||
url: "/course/überbetriebliche-kurse/learn/fahrzeug/präsenzkurs-fahrzeug",
|
||||
course_session: 2,
|
||||
page: 413,
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
start: dayjs("2023-08-09T15:00:00+02:00"),
|
||||
end: dayjs("2023-08-09T19:00:00+02:00"),
|
||||
title: "Präsenzkurs Fahrräder",
|
||||
url: "/course/überbetriebliche-kurse/learn/fahrzeug/präsenzkurs-fahrzeug",
|
||||
course_session: 2,
|
||||
page: 413,
|
||||
},
|
||||
];
|
||||
};
|
||||
|
|
@ -37,7 +37,7 @@ import { onMounted, ref, watch } from "vue";
|
|||
import type { Circle } from "@/services/circle";
|
||||
|
||||
interface FeedbackSummary {
|
||||
circle_id: number;
|
||||
circle_id: string;
|
||||
count: number;
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ function makeSummary(
|
|||
const props = defineProps<{
|
||||
selctedCircles: string[];
|
||||
circles: Circle[];
|
||||
courseSessionId: number;
|
||||
courseSessionId: string;
|
||||
url: string;
|
||||
}>();
|
||||
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ type Story = StoryObj<typeof AccountMenuContent>;
|
|||
|
||||
const courseSessions = [
|
||||
{
|
||||
id: 1,
|
||||
id: "1",
|
||||
title: "Bern 2023 a",
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
id: "2",
|
||||
title: "Zürich 2023 a",
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import type { CourseSession } from "@/types";
|
|||
const props = defineProps<{
|
||||
courseSessions: CourseSession[];
|
||||
user: UserState;
|
||||
selectedCourseSession?: number;
|
||||
selectedCourseSession?: string;
|
||||
}>();
|
||||
|
||||
const emit = defineEmits(["selectCourseSession", "logout"]);
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ export interface Item {
|
|||
|
||||
export interface Props {
|
||||
items: CourseSession[];
|
||||
selected?: number;
|
||||
selected?: string;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const emit = defineEmits<{
|
|||
const props = withDefaults(defineProps<Props>(), {
|
||||
modelValue: () => {
|
||||
return {
|
||||
id: -1,
|
||||
id: "-1",
|
||||
name: "",
|
||||
};
|
||||
},
|
||||
|
|
|
|||
|
|
@ -33,14 +33,14 @@ export function useCurrentCourseSession() {
|
|||
return result;
|
||||
}
|
||||
|
||||
export function useCourseSessionDetailQuery(courSessionId?: string | number) {
|
||||
export function useCourseSessionDetailQuery(courSessionId?: string) {
|
||||
if (!courSessionId) {
|
||||
courSessionId = useCurrentCourseSession().value.id;
|
||||
}
|
||||
const queryResult = useQuery({
|
||||
query: COURSE_SESSION_DETAIL_QUERY,
|
||||
variables: {
|
||||
courseSessionId: courSessionId.toString(),
|
||||
courseSessionId: courSessionId,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ import DueDatesList from "@/components/dueDates/DueDatesList.vue";
|
|||
|
||||
const { t } = useTranslation();
|
||||
|
||||
const UNFILTERED = Number.MAX_SAFE_INTEGER;
|
||||
const UNFILTERED = Number.MAX_SAFE_INTEGER.toString();
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
const learningPathStore = useLearningPathStore();
|
||||
|
||||
type Item = {
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
|
||||
|
|
@ -108,7 +108,7 @@ const isMatchingCircle = (dueDate: DueDate) =>
|
|||
dueDate.circle?.id === selectedCircle.value.id;
|
||||
|
||||
const isMatchingCourse = (dueDate: DueDate) =>
|
||||
courseSessions.value.map((cs) => cs.id).includes(dueDate.course_session as number);
|
||||
courseSessions.value.map((cs) => cs.id).includes(dueDate.course_session);
|
||||
|
||||
const numAppointmentsToShow = ref(7);
|
||||
const canLoadMore = computed(() => {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<script setup lang="ts">
|
||||
import { useCurrentCourseSession, useCourseSessionDetailQuery } from "@/composables";
|
||||
import { useCourseSessionDetailQuery, useCurrentCourseSession } from "@/composables";
|
||||
import { ASSIGNMENT_COMPLETION_QUERY } from "@/graphql/queries";
|
||||
import EvaluationContainer from "@/pages/cockpit/assignmentEvaluationPage/EvaluationContainer.vue";
|
||||
import AssignmentSubmissionResponses from "@/pages/learningPath/learningContentPage/assignment/AssignmentSubmissionResponses.vue";
|
||||
|
|
@ -26,7 +26,7 @@ const router = useRouter();
|
|||
const queryResult = useQuery({
|
||||
query: ASSIGNMENT_COMPLETION_QUERY,
|
||||
variables: {
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
courseSessionId: courseSession.value.id,
|
||||
assignmentId: props.assignmentId,
|
||||
assignmentUserId: props.userId,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ async function startEvaluation() {
|
|||
log.debug("startEvaluation");
|
||||
if (props.assignmentCompletion.completion_status !== "EVALUATION_SUBMITTED") {
|
||||
upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
assignmentUserId: props.assignmentUser.user_id.toString(),
|
||||
assignmentId: props.assignment.id,
|
||||
courseSessionId: courseSession.value.id,
|
||||
assignmentUserId: props.assignmentUser.user_id,
|
||||
completionStatus: "EVALUATION_IN_PROGRESS",
|
||||
completionDataString: JSON.stringify({}),
|
||||
// next line used for urql
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ const upsertAssignmentCompletionMutation = useMutation(
|
|||
|
||||
async function submitEvaluation() {
|
||||
upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
assignmentUserId: props.assignmentUser.user_id.toString(),
|
||||
assignmentId: props.assignment.id,
|
||||
courseSessionId: courseSession.value.id,
|
||||
assignmentUserId: props.assignmentUser.user_id,
|
||||
completionStatus: "EVALUATION_SUBMITTED",
|
||||
completionDataString: JSON.stringify({}),
|
||||
evaluationPoints: userPoints.value,
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@ async function evaluateAssignmentCompletion(completionData: AssignmentCompletion
|
|||
log.debug("evaluateAssignmentCompletion", completionData);
|
||||
|
||||
upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
assignmentUserId: props.assignmentUser.user_id.toString(),
|
||||
assignmentId: props.assignment.id,
|
||||
courseSessionId: courseSession.value.id,
|
||||
assignmentUserId: props.assignmentUser.user_id,
|
||||
completionStatus: "EVALUATION_IN_PROGRESS",
|
||||
completionDataString: JSON.stringify(completionData),
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const state = reactive({
|
|||
statusByUser: [] as {
|
||||
userStatus: AssignmentCompletionStatus;
|
||||
progressStatus: StatusCountKey;
|
||||
userId: number;
|
||||
userId: string;
|
||||
}[],
|
||||
submissionProgressStatusCount: {} as StatusCount,
|
||||
gradingProgressStatusCount: {} as StatusCount,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { useCourseSessionDetailQuery } from "@/composables";
|
|||
|
||||
const props = defineProps<{
|
||||
courseSession: CourseSession;
|
||||
circleId: number;
|
||||
circleId: string;
|
||||
}>();
|
||||
|
||||
log.debug("FeedbackSubmissionProgress created");
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ import { learningContentTypeData } from "@/utils/typeMaps";
|
|||
import { useCourseSessionDetailQuery } from "@/composables";
|
||||
|
||||
interface Submittable {
|
||||
id: number;
|
||||
id: string;
|
||||
circleName: string;
|
||||
frontendUrl: string;
|
||||
title: string;
|
||||
|
|
@ -27,7 +27,7 @@ interface Submittable {
|
|||
|
||||
const props = defineProps<{
|
||||
courseSession: CourseSession;
|
||||
selectedCircle: number;
|
||||
selectedCircle: string;
|
||||
}>();
|
||||
|
||||
log.debug("SubmissionsOverview created", props.courseSession.id);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const formData = reactive<DocumentUploadData>({
|
|||
file: null,
|
||||
name: "",
|
||||
learningSequence: {
|
||||
id: -1,
|
||||
id: "-1",
|
||||
name: t("circlePage.documents.chooseSequence"),
|
||||
},
|
||||
});
|
||||
|
|
@ -56,7 +56,7 @@ function submitForm() {
|
|||
|
||||
function validateForm() {
|
||||
formErrors.file = formData.file === null;
|
||||
formErrors.learningSequence = formData.learningSequence.id === -1;
|
||||
formErrors.learningSequence = formData.learningSequence.id === "-1";
|
||||
formErrors.name = formData.name === "";
|
||||
|
||||
for (const [, value] of Object.entries(formErrors)) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const certificatesQuery = useQuery({
|
|||
query: COMPETENCE_NAVI_CERTIFICATE_QUERY,
|
||||
variables: {
|
||||
courseSlug: props.courseSlug,
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
courseSessionId: courseSession.value.id,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ const certificatesQuery = useQuery({
|
|||
query: COMPETENCE_NAVI_CERTIFICATE_QUERY,
|
||||
variables: {
|
||||
courseSlug: props.courseSlug,
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
courseSessionId: courseSession.value.id,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ const certificatesQuery = useQuery({
|
|||
query: COMPETENCE_NAVI_CERTIFICATE_QUERY,
|
||||
variables: {
|
||||
courseSlug: props.courseSlug,
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
courseSessionId: courseSession.value.id,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ import { useCircleStore } from "@/stores/circle";
|
|||
|
||||
const props = defineProps<{
|
||||
assignment: Assignment;
|
||||
learningContentId: number;
|
||||
learningContentId: string;
|
||||
assignmentCompletion?: AssignmentCompletion;
|
||||
courseSessionId: number;
|
||||
courseSessionId: string;
|
||||
submissionDeadlineStart?: string;
|
||||
}>();
|
||||
|
||||
|
|
@ -83,9 +83,9 @@ const onEditTask = (task: AssignmentTask) => {
|
|||
const onSubmit = async () => {
|
||||
try {
|
||||
await upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignment.id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
learningContentId: props.learningContentId.toString(),
|
||||
assignmentId: props.assignment.id,
|
||||
courseSessionId: courseSession.value.id,
|
||||
learningContentId: props.learningContentId,
|
||||
completionDataString: JSON.stringify({}),
|
||||
completionStatus: "SUBMITTED",
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@ import log from "loglevel";
|
|||
import { computed, reactive } from "vue";
|
||||
|
||||
const props = defineProps<{
|
||||
assignmentId: number;
|
||||
learningContentId: number;
|
||||
assignmentId: string;
|
||||
learningContentId: string;
|
||||
task: AssignmentTask;
|
||||
assignmentCompletion?: AssignmentCompletion;
|
||||
}>();
|
||||
|
|
@ -33,9 +33,9 @@ const upsertAssignmentCompletionMutation = useMutation(
|
|||
async function upsertAssignmentCompletion(completion_data: AssignmentCompletionData) {
|
||||
try {
|
||||
await upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.assignmentId.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
learningContentId: props.learningContentId.toString(),
|
||||
assignmentId: props.assignmentId,
|
||||
courseSessionId: courseSession.value.id,
|
||||
learningContentId: props.learningContentId,
|
||||
completionDataString: JSON.stringify(completion_data),
|
||||
completionStatus: "IN_PROGRESS",
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ const props = defineProps<{
|
|||
const queryResult = useQuery({
|
||||
query: ASSIGNMENT_COMPLETION_QUERY,
|
||||
variables: {
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
assignmentId: props.learningContent.content_assignment_id.toString(),
|
||||
learningContentId: props.learningContent.id.toString(),
|
||||
courseSessionId: courseSession.value.id,
|
||||
assignmentId: props.learningContent.content_assignment_id,
|
||||
learningContentId: props.learningContent.id,
|
||||
},
|
||||
pause: true,
|
||||
});
|
||||
|
|
@ -47,7 +47,7 @@ const upsertAssignmentCompletionMutation = useMutation(
|
|||
);
|
||||
|
||||
const submissionDeadline = computed(() => {
|
||||
return courseSessionDetailResult.findAssignment(props.learningContent.id.toString())
|
||||
return courseSessionDetailResult.findAssignment(props.learningContent.id)
|
||||
?.submission_deadline;
|
||||
});
|
||||
|
||||
|
|
@ -122,9 +122,9 @@ const currentTask = computed(() => {
|
|||
const initUpsertAssignmentCompletion = async () => {
|
||||
try {
|
||||
await upsertAssignmentCompletionMutation.executeMutation({
|
||||
assignmentId: props.learningContent.content_assignment_id.toString(),
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
learningContentId: props.learningContent.id.toString(),
|
||||
assignmentId: props.learningContent.content_assignment_id,
|
||||
courseSessionId: courseSession.value.id,
|
||||
learningContentId: props.learningContent.id,
|
||||
completionDataString: JSON.stringify({}),
|
||||
completionStatus: "IN_PROGRESS",
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
|
|
|
|||
|
|
@ -32,9 +32,9 @@ const courseSessionEdoniqTest = computed(() => {
|
|||
const queryResult = useQuery({
|
||||
query: ASSIGNMENT_COMPLETION_QUERY,
|
||||
variables: {
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
assignmentId: props.content.content_assignment_id.toString(),
|
||||
learningContentId: props.content.id.toString(),
|
||||
courseSessionId: courseSession.value.id,
|
||||
assignmentId: props.content.content_assignment_id,
|
||||
learningContentId: props.content.id,
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -192,8 +192,8 @@ function hasStepValidInput(stepNumber: number) {
|
|||
function mutateFeedback(data: FeedbackData, submit = false) {
|
||||
log.debug("mutate feedback", feedbackData);
|
||||
return executeMutation({
|
||||
courseSessionId: courseSession.value.id.toString(),
|
||||
learningContentId: props.content.id.toString(),
|
||||
courseSessionId: courseSession.value.id,
|
||||
learningContentId: props.content.id,
|
||||
data: data,
|
||||
submitted: submit,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ export function calcLearningContentAssignments(learningPath?: LearningPath) {
|
|||
}
|
||||
|
||||
export async function loadAssignmentCompletionStatusData(
|
||||
assignmentId: number,
|
||||
courseSessionId: number,
|
||||
learningContentId: number
|
||||
assignmentId: string,
|
||||
courseSessionId: string,
|
||||
learningContentId: string
|
||||
) {
|
||||
const courseSessionDetailResult = useCourseSessionDetailQuery();
|
||||
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ export class Circle implements WagtailCircle {
|
|||
previousCircle?: Circle;
|
||||
|
||||
constructor(
|
||||
public readonly id: number,
|
||||
public readonly id: string,
|
||||
public readonly slug: string,
|
||||
public readonly title: string,
|
||||
public readonly translation_key: string,
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ type FileData = {
|
|||
url: string;
|
||||
};
|
||||
|
||||
async function startFileUpload(fileData: DocumentUploadData, courseSessionId: number) {
|
||||
async function startFileUpload(fileData: DocumentUploadData, courseSessionId: string) {
|
||||
if (fileData === null || fileData.file === null) {
|
||||
return null;
|
||||
}
|
||||
|
|
@ -73,7 +73,7 @@ function handleUpload(url: string, options: RequestInit) {
|
|||
|
||||
export async function uploadCircleDocument(
|
||||
data: DocumentUploadData,
|
||||
courseSessionId: number,
|
||||
courseSessionId: string,
|
||||
bustCacheUrlKey = ""
|
||||
) {
|
||||
if (data.file === null) {
|
||||
|
|
@ -102,6 +102,6 @@ export async function deleteCircleDocument(documentId: string, bustCacheUrlKey =
|
|||
return result;
|
||||
}
|
||||
|
||||
export async function fetchCourseSessionDocuments(courseSessionId: number) {
|
||||
export async function fetchCourseSessionDocuments(courseSessionId: string) {
|
||||
return itGetCached(`/api/core/document/list/${courseSessionId}/`);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ export class LearningPath implements WagtailLearningPath {
|
|||
}
|
||||
|
||||
constructor(
|
||||
public readonly id: number,
|
||||
public readonly id: string,
|
||||
public readonly slug: string,
|
||||
public readonly title: string,
|
||||
public readonly translation_key: string,
|
||||
|
|
|
|||
|
|
@ -35,11 +35,11 @@ describe("CourseSession Store", () => {
|
|||
};
|
||||
courseSessions = [
|
||||
{
|
||||
id: 1,
|
||||
id: "1",
|
||||
created_at: "2021-05-11T10:00:00.000000Z",
|
||||
updated_at: "2023-05-11T10:00:00.000000Z",
|
||||
course: {
|
||||
id: 1,
|
||||
id: "1",
|
||||
title: "Test Course",
|
||||
category_name: "Test Category",
|
||||
slug: "test-course",
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ export const useCompetenceStore = defineStore({
|
|||
},
|
||||
flatPerformanceCriteria(
|
||||
userId: string | undefined = undefined,
|
||||
circleId: number | undefined = undefined
|
||||
circleId: string | undefined = undefined
|
||||
) {
|
||||
if (!userId) {
|
||||
const userStore = useUserStore();
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export const useCompletionStore = defineStore({
|
|||
getters: {},
|
||||
actions: {
|
||||
async loadCourseSessionCompletionData(
|
||||
courseSessionId: number,
|
||||
courseSessionId: string,
|
||||
userId: string,
|
||||
reload = false
|
||||
) {
|
||||
|
|
@ -31,7 +31,7 @@ export const useCompletionStore = defineStore({
|
|||
async markPage(
|
||||
page: BaseCourseWagtailPage,
|
||||
userId: string | undefined = undefined,
|
||||
courseSessionId: number | undefined = undefined
|
||||
courseSessionId: string | undefined = undefined
|
||||
) {
|
||||
if (!courseSessionId) {
|
||||
const courseSessionsStore = useCourseSessionsStore();
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export const useCourseSessionsStore = defineStore("courseSessions", () => {
|
|||
|
||||
const selectedCourseSessionMap = useLocalStorage(
|
||||
SELECTED_COURSE_SESSIONS_KEY,
|
||||
new Map<string, number>()
|
||||
new Map<string, string>()
|
||||
);
|
||||
|
||||
const _currentCourseSlug = ref("");
|
||||
|
|
@ -84,13 +84,13 @@ export const useCourseSessionsStore = defineStore("courseSessions", () => {
|
|||
eventBus.emit("switchedCourseSession", courseSession.id);
|
||||
}
|
||||
|
||||
function getCourseSessionById(courseSessionId: number | string) {
|
||||
function getCourseSessionById(courseSessionId: string) {
|
||||
return allCourseSessions.value.find((cs) => {
|
||||
return courseSessionId.toString() === cs.id.toString();
|
||||
});
|
||||
}
|
||||
|
||||
function switchCourseSessionById(courseSessionId: number | string) {
|
||||
function switchCourseSessionById(courseSessionId: string) {
|
||||
const courseSession = allCourseSessions.value.find((cs) => {
|
||||
return courseSessionId.toString() === cs.id.toString();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ export type UserState = {
|
|||
username: string;
|
||||
avatar_url: string;
|
||||
is_superuser: boolean;
|
||||
course_session_experts: number[];
|
||||
course_session_experts: string[];
|
||||
loggedIn: boolean;
|
||||
language: AvailableLanguages;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ export type LoginMethod = "local" | "sso";
|
|||
export type CourseCompletionStatus = "UNKNOWN" | "FAIL" | "SUCCESS";
|
||||
|
||||
export interface BaseCourseWagtailPage {
|
||||
readonly id: number;
|
||||
readonly id: string;
|
||||
readonly title: string;
|
||||
readonly slug: string;
|
||||
readonly content_type: string;
|
||||
|
|
@ -18,7 +18,7 @@ export interface BaseCourseWagtailPage {
|
|||
}
|
||||
|
||||
export interface CircleLight {
|
||||
readonly id: number;
|
||||
readonly id: string;
|
||||
readonly slug: string;
|
||||
readonly title: string;
|
||||
}
|
||||
|
|
@ -52,10 +52,10 @@ export interface LearningContentInterface extends BaseCourseWagtailPage {
|
|||
|
||||
export interface LearningContentAssignment extends LearningContentInterface {
|
||||
readonly content_type: "learnpath.LearningContentAssignment";
|
||||
readonly content_assignment_id: number;
|
||||
readonly content_assignment_id: string;
|
||||
readonly assignment_type: AssignmentType;
|
||||
readonly competence_certificate?: {
|
||||
id: number;
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
content_type: string;
|
||||
|
|
@ -104,9 +104,9 @@ export interface LearningContentEdoniqTest extends LearningContentInterface {
|
|||
readonly content_type: "learnpath.LearningContentEdoniqTest";
|
||||
readonly checkbox_text: string;
|
||||
readonly has_extended_time_test: boolean;
|
||||
readonly content_assignment_id: number;
|
||||
readonly content_assignment_id: string;
|
||||
readonly competence_certificate?: {
|
||||
id: number;
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
content_type: string;
|
||||
|
|
@ -191,22 +191,22 @@ export interface CourseCompletion {
|
|||
created_at: string;
|
||||
updated_at: string;
|
||||
readonly user: number;
|
||||
readonly page_id: number;
|
||||
readonly page_id: string;
|
||||
readonly page_type: string;
|
||||
readonly course_session_id: number;
|
||||
readonly course_session_id: string;
|
||||
completion_status: CourseCompletionStatus;
|
||||
additional_json_data: unknown;
|
||||
}
|
||||
|
||||
export interface Course {
|
||||
id: number;
|
||||
id: string;
|
||||
title: string;
|
||||
category_name: string;
|
||||
slug: string;
|
||||
}
|
||||
|
||||
export interface CourseCategory {
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
general: boolean;
|
||||
}
|
||||
|
|
@ -381,7 +381,7 @@ export interface Assignment extends BaseCourseWagtailPage {
|
|||
readonly evaluation_tasks: AssignmentEvaluationTask[];
|
||||
readonly max_points: number;
|
||||
readonly competence_certificate?: {
|
||||
id: number;
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
content_type: string;
|
||||
|
|
@ -452,7 +452,7 @@ export interface CircleExpert {
|
|||
user_email: string;
|
||||
user_first_name: string;
|
||||
user_last_name: string;
|
||||
circle_id: number;
|
||||
circle_id: string;
|
||||
circle_slug: string;
|
||||
circle_translation_key: string;
|
||||
}
|
||||
|
|
@ -470,7 +470,7 @@ export interface CircleDocument {
|
|||
}
|
||||
|
||||
export interface CourseSessionAttendanceCourse {
|
||||
id: number;
|
||||
id: string;
|
||||
due_date: SimpleDueDate;
|
||||
location: string;
|
||||
trainer: string;
|
||||
|
|
@ -498,7 +498,7 @@ export interface CourseSessionAssignment {
|
|||
|
||||
export interface CourseSessionEdoniqTest {
|
||||
id: number;
|
||||
course_session_id: number;
|
||||
course_session_id: string;
|
||||
deadline: SimpleDueDate;
|
||||
learning_content: {
|
||||
id: string;
|
||||
|
|
@ -511,23 +511,14 @@ export interface CourseSessionEdoniqTest {
|
|||
}
|
||||
|
||||
export interface CourseSession {
|
||||
id: number;
|
||||
id: string;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
course: Course;
|
||||
title: string;
|
||||
start_date: string;
|
||||
end_date: string;
|
||||
// learning_path_url: string;
|
||||
// cockpit_url: string;
|
||||
// competence_url: string;
|
||||
course_url: string;
|
||||
// media_library_url: string;
|
||||
// attendance_courses: CourseSessionAttendanceCourse[];
|
||||
// assignments: CourseSessionAssignment[];
|
||||
// edoniq_tests: CourseSessionEdoniqTest[];
|
||||
// documents: CircleDocument[];
|
||||
// users: CourseSessionUser[];
|
||||
due_dates: DueDate[];
|
||||
}
|
||||
|
||||
|
|
@ -541,7 +532,7 @@ export interface CourseSessionUser {
|
|||
avatar_url: string;
|
||||
role: Role;
|
||||
circles: {
|
||||
id: number;
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
translation_key: string;
|
||||
|
|
@ -551,7 +542,7 @@ export interface CourseSessionUser {
|
|||
export interface ExpertSessionUser extends CourseSessionUser {
|
||||
role: "EXPERT";
|
||||
circles: {
|
||||
id: number;
|
||||
id: string;
|
||||
title: string;
|
||||
slug: string;
|
||||
translation_key: string;
|
||||
|
|
@ -577,7 +568,7 @@ export interface DocumentUploadData {
|
|||
file: File | null;
|
||||
name: string;
|
||||
learningSequence: {
|
||||
id: number;
|
||||
id: string;
|
||||
name: string;
|
||||
};
|
||||
}
|
||||
|
|
@ -647,8 +638,8 @@ export interface AssignmentCompletion {
|
|||
}
|
||||
|
||||
export type UpsertUserAssignmentCompletion = {
|
||||
assignment_id: number;
|
||||
course_session_id: number;
|
||||
assignment_id: string;
|
||||
course_session_id: string;
|
||||
completion_status: AssignmentCompletionStatus;
|
||||
completion_data: AssignmentCompletionData;
|
||||
};
|
||||
|
|
@ -665,11 +656,11 @@ export interface UserAssignmentCompletionStatus {
|
|||
assignment_user_id: string;
|
||||
completion_status: AssignmentCompletionStatus;
|
||||
evaluation_points: number | null;
|
||||
learning_content_page_id: number;
|
||||
learning_content_page_id: string;
|
||||
}
|
||||
|
||||
export type SimpleDueDate = {
|
||||
id: number;
|
||||
id: string;
|
||||
start: string;
|
||||
end?: string;
|
||||
};
|
||||
|
|
@ -681,7 +672,5 @@ export type DueDate = SimpleDueDate & {
|
|||
subtitle: string;
|
||||
url: string;
|
||||
url_expert: string;
|
||||
course_session: number | null;
|
||||
page: number | null;
|
||||
circle: CircleLight | null;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ import mitt from "mitt";
|
|||
export type MittEvents = {
|
||||
// event needed so that the App components do re-render
|
||||
// and reload the current course session
|
||||
switchedCourseSession: number;
|
||||
switchedCourseSession: string;
|
||||
|
||||
finishedLearningContent: boolean;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import json
|
|||
import re
|
||||
|
||||
from django.utils.safestring import mark_safe
|
||||
from rest_framework import serializers
|
||||
from rest_framework.throttling import UserRateThrottle
|
||||
|
||||
|
||||
|
|
@ -41,6 +42,11 @@ def get_django_content_type(obj):
|
|||
return obj._meta.app_label + "." + type(obj).__name__
|
||||
|
||||
|
||||
class StringIDField(serializers.Field):
|
||||
def to_representation(self, value):
|
||||
return str(value)
|
||||
|
||||
|
||||
def pretty_print_json(json_string):
|
||||
try:
|
||||
parsed = json_string
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ from vbv_lernwelt.core.serializer_helpers import (
|
|||
get_it_serializer_class,
|
||||
ItWagtailBaseSerializer,
|
||||
)
|
||||
from vbv_lernwelt.core.utils import StringIDField
|
||||
|
||||
|
||||
class CourseBaseSerializer(ItWagtailBaseSerializer):
|
||||
id = StringIDField()
|
||||
course = SerializerMethodField()
|
||||
course_category = SerializerMethodField()
|
||||
circles = SerializerMethodField()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from vbv_lernwelt.core.utils import StringIDField
|
||||
from vbv_lernwelt.course.models import (
|
||||
CircleDocument,
|
||||
Course,
|
||||
|
|
@ -12,6 +13,8 @@ from vbv_lernwelt.duedate.serializers import DueDateSerializer
|
|||
|
||||
|
||||
class CourseSerializer(serializers.ModelSerializer):
|
||||
id = StringIDField()
|
||||
|
||||
class Meta:
|
||||
model = Course
|
||||
fields = ["id", "title", "category_name", "slug"]
|
||||
|
|
@ -28,6 +31,9 @@ class CourseCategorySerializer(serializers.ModelSerializer):
|
|||
|
||||
|
||||
class CourseCompletionSerializer(serializers.ModelSerializer):
|
||||
page_id = StringIDField()
|
||||
course_session_id = StringIDField()
|
||||
|
||||
class Meta:
|
||||
model = CourseCompletion
|
||||
fields = [
|
||||
|
|
@ -44,17 +50,10 @@ class CourseCompletionSerializer(serializers.ModelSerializer):
|
|||
|
||||
|
||||
class CourseSessionSerializer(serializers.ModelSerializer):
|
||||
id = StringIDField()
|
||||
|
||||
course = serializers.SerializerMethodField()
|
||||
course_url = serializers.SerializerMethodField()
|
||||
# learning_path_url = serializers.SerializerMethodField()
|
||||
# cockpit_url = serializers.SerializerMethodField()
|
||||
# competence_url = serializers.SerializerMethodField()
|
||||
# media_library_url = serializers.SerializerMethodField()
|
||||
# documents = serializers.SerializerMethodField()
|
||||
# attendance_courses = serializers.SerializerMethodField()
|
||||
# assignments = serializers.SerializerMethodField()
|
||||
# edoniq_tests = serializers.SerializerMethodField()
|
||||
|
||||
due_dates = serializers.SerializerMethodField()
|
||||
|
||||
def get_course(self, obj):
|
||||
|
|
@ -107,11 +106,11 @@ class CircleDocumentSerializer(serializers.ModelSerializer):
|
|||
circle = ls.get_circle()
|
||||
return {
|
||||
"title": ls.title,
|
||||
"id": ls.id,
|
||||
"id": str(ls.id),
|
||||
"slug": ls.slug,
|
||||
"circle": {
|
||||
"title": circle.title,
|
||||
"id": circle.id,
|
||||
"id": str(circle.id),
|
||||
"slug": circle.slug,
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,82 +1 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from vbv_lernwelt.course_session.models import (
|
||||
CourseSessionAssignment,
|
||||
CourseSessionAttendanceCourse,
|
||||
CourseSessionEdoniqTest,
|
||||
)
|
||||
|
||||
|
||||
class CourseSessionAttendanceCourseSerializer(serializers.ModelSerializer):
|
||||
start = serializers.SerializerMethodField()
|
||||
end = serializers.SerializerMethodField()
|
||||
circle_title = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = CourseSessionAttendanceCourse
|
||||
fields = [
|
||||
"id",
|
||||
"course_session",
|
||||
"learning_content_id",
|
||||
"due_date_id",
|
||||
"location",
|
||||
"trainer",
|
||||
"start",
|
||||
"end",
|
||||
"circle_title",
|
||||
]
|
||||
|
||||
def get_start(self, obj):
|
||||
return obj.due_date.start
|
||||
|
||||
def get_end(self, obj):
|
||||
return obj.due_date.end
|
||||
|
||||
def get_circle_title(self, obj):
|
||||
circle = obj.get_circle()
|
||||
if circle:
|
||||
return circle.title
|
||||
return ""
|
||||
|
||||
|
||||
class CourseSessionAssignmentSerializer(serializers.ModelSerializer):
|
||||
submission_deadline_start = serializers.SerializerMethodField()
|
||||
evaluation_deadline_start = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = CourseSessionAssignment
|
||||
fields = [
|
||||
"id",
|
||||
"course_session_id",
|
||||
"learning_content_id",
|
||||
"submission_deadline_id",
|
||||
"submission_deadline_start",
|
||||
"evaluation_deadline_id",
|
||||
"evaluation_deadline_start",
|
||||
]
|
||||
|
||||
def get_evaluation_deadline_start(self, obj):
|
||||
if obj.evaluation_deadline:
|
||||
return obj.evaluation_deadline.start
|
||||
|
||||
def get_submission_deadline_start(self, obj):
|
||||
if obj.submission_deadline:
|
||||
return obj.submission_deadline.start
|
||||
|
||||
|
||||
class CourseSessionEdoniqTestSerializer(serializers.ModelSerializer):
|
||||
deadline_start = serializers.SerializerMethodField()
|
||||
|
||||
class Meta:
|
||||
model = CourseSessionEdoniqTest
|
||||
fields = [
|
||||
"id",
|
||||
"course_session_id",
|
||||
"learning_content_id",
|
||||
"deadline_id",
|
||||
"deadline_start",
|
||||
]
|
||||
|
||||
def get_deadline_start(self, obj):
|
||||
if obj.deadline:
|
||||
return obj.deadline.start
|
||||
|
|
|
|||
|
|
@ -1,14 +1,20 @@
|
|||
from rest_framework import serializers
|
||||
|
||||
from vbv_lernwelt.core.utils import StringIDField
|
||||
from vbv_lernwelt.duedate.models import DueDate
|
||||
|
||||
|
||||
class DueDateSerializer(serializers.ModelSerializer):
|
||||
# circle = serializers.SerializerMethodField()
|
||||
id = StringIDField()
|
||||
circle = serializers.SerializerMethodField()
|
||||
|
||||
# course_session = StringIDField()
|
||||
# page = StringIDField()
|
||||
|
||||
class Meta:
|
||||
model = DueDate
|
||||
fields = [
|
||||
"id",
|
||||
"start",
|
||||
"end",
|
||||
"manual_override_fields",
|
||||
|
|
@ -20,7 +26,7 @@ class DueDateSerializer(serializers.ModelSerializer):
|
|||
"url_expert",
|
||||
"course_session",
|
||||
"page",
|
||||
# "circle",
|
||||
"circle",
|
||||
]
|
||||
|
||||
def get_circle(self, obj):
|
||||
|
|
@ -28,7 +34,7 @@ class DueDateSerializer(serializers.ModelSerializer):
|
|||
|
||||
if circle:
|
||||
return {
|
||||
"id": circle.id,
|
||||
"id": str(circle.id),
|
||||
"title": circle.title,
|
||||
"translation_key": circle.translation_key,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class LearningContentEdoniqTestSerializer(
|
|||
try:
|
||||
cert = obj.content_assignment.competence_certificate
|
||||
return {
|
||||
"id": cert.id,
|
||||
"id": str(cert.id),
|
||||
"title": cert.title,
|
||||
"slug": cert.slug,
|
||||
"content_type": get_django_content_type(cert),
|
||||
|
|
@ -89,7 +89,7 @@ class LearningContentAssignmentSerializer(
|
|||
try:
|
||||
cert = obj.content_assignment.competence_certificate
|
||||
return {
|
||||
"id": cert.id,
|
||||
"id": str(cert.id),
|
||||
"title": cert.title,
|
||||
"slug": cert.slug,
|
||||
"content_type": get_django_content_type(cert),
|
||||
|
|
|
|||
Loading…
Reference in New Issue