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