Skip to content

Commit 976896b

Browse files
committed
Adding questionnaire data + changing template
1 parent 9878552 commit 976896b

3 files changed

Lines changed: 50 additions & 0 deletions

File tree

src/lib/data/test-evaluations.ts

Whitespace-only changes.

src/lib/models/questionnaire.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
export type QuestionType = 'rating' | 'multiple_choice' | 'text' | 'boolean';
2+
3+
// Modelling for each individual question
4+
// Every question needs an id, text prompt, assigned type, and requirement
5+
export interface QuestionBase {
6+
id: string;
7+
prompt: string;
8+
required: boolean;
9+
10+
}
11+
12+
// Implementing discriminated unions
13+
// 'type' is the discriminator
14+
15+
export type Question =
16+
| (QuestionBase & {
17+
type: 'rating';
18+
min: number;
19+
max: number;
20+
labels?: { min?: string; max?: string };
21+
})
22+
| (QuestionBase & {
23+
type: 'multiple_choice';
24+
options: string[]; // required for multiple_choice
25+
})
26+
| (QuestionBase & {
27+
type: 'boolean';
28+
trueLabel?: string;
29+
falseLabel?: string;
30+
})
31+
| (QuestionBase & {
32+
type: 'text';
33+
placeholder?: string;
34+
multiline?: boolean;
35+
maxLength?: number;
36+
})
37+
38+
// Modelling for the questionnaire
39+
export interface Questionnaire {
40+
id: string; // Unique Questionnaire ID
41+
slug?: string; // helps mapping
42+
title: string; // Course name
43+
courseId: string; // Course ID
44+
instructor: string; // Professor's name
45+
semester: string; // Semester of course "Fall XXXX" or "Spring XXXX"
46+
isActive: boolean; // The current availability of a Course Eval
47+
questions: Question[]; // Question list
48+
createdAt: string; // Creation date of the questionnaire
49+
updatedAt: string;
50+
}

src/routes/in/evaluation/[slug]/+page.server.ts

Whitespace-only changes.

0 commit comments

Comments
 (0)