Initial draft of level test report

This commit is contained in:
Joao Ramos
2024-08-20 23:40:54 +01:00
parent 3367384791
commit 65f8368708
4 changed files with 693 additions and 393 deletions

View File

@@ -1,162 +1,195 @@
import {Module} from ".";
import {InstructorGender, ShuffleMap} from "./exam";
import {PermissionType} from "./permissions";
import { Module } from ".";
import { InstructorGender, ShuffleMap } from "./exam";
import { PermissionType } from "./permissions";
export type User = StudentUser | TeacherUser | CorporateUser | AgentUser | AdminUser | DeveloperUser | MasterCorporateUser;
export type User =
| StudentUser
| TeacherUser
| CorporateUser
| AgentUser
| AdminUser
| DeveloperUser
| MasterCorporateUser;
export type UserStatus = "active" | "disabled" | "paymentDue";
export interface BasicUser {
email: string;
name: string;
profilePicture: string;
id: string;
isFirstLogin: boolean;
focus: "academic" | "general";
levels: {[key in Module]: number};
desiredLevels: {[key in Module]: number};
type: Type;
bio: string;
isVerified: boolean;
subscriptionExpirationDate?: null | Date;
registrationDate?: Date;
status: UserStatus;
permissions: PermissionType[];
lastLogin?: Date;
email: string;
name: string;
profilePicture: string;
id: string;
isFirstLogin: boolean;
focus: "academic" | "general";
levels: { [key in Module]: number };
desiredLevels: { [key in Module]: number };
type: Type;
bio: string;
isVerified: boolean;
subscriptionExpirationDate?: null | Date;
registrationDate?: Date;
status: UserStatus;
permissions: PermissionType[];
lastLogin?: Date;
}
export interface StudentUser extends BasicUser {
type: "student";
preferredGender?: InstructorGender;
demographicInformation?: DemographicInformation;
preferredTopics?: string[];
type: "student";
preferredGender?: InstructorGender;
demographicInformation?: DemographicInformation;
preferredTopics?: string[];
}
export interface TeacherUser extends BasicUser {
type: "teacher";
demographicInformation?: DemographicInformation;
type: "teacher";
demographicInformation?: DemographicInformation;
}
export interface CorporateUser extends BasicUser {
type: "corporate";
corporateInformation: CorporateInformation;
demographicInformation?: DemographicCorporateInformation;
type: "corporate";
corporateInformation: CorporateInformation;
demographicInformation?: DemographicCorporateInformation;
}
export interface MasterCorporateUser extends BasicUser {
type: "mastercorporate";
corporateInformation: CorporateInformation;
demographicInformation?: DemographicCorporateInformation;
type: "mastercorporate";
corporateInformation: CorporateInformation;
demographicInformation?: DemographicCorporateInformation;
}
export interface AgentUser extends BasicUser {
type: "agent";
agentInformation: AgentInformation;
demographicInformation?: DemographicInformation;
type: "agent";
agentInformation: AgentInformation;
demographicInformation?: DemographicInformation;
}
export interface AdminUser extends BasicUser {
type: "admin";
demographicInformation?: DemographicInformation;
type: "admin";
demographicInformation?: DemographicInformation;
}
export interface DeveloperUser extends BasicUser {
type: "developer";
preferredGender?: InstructorGender;
demographicInformation?: DemographicInformation;
preferredTopics?: string[];
type: "developer";
preferredGender?: InstructorGender;
demographicInformation?: DemographicInformation;
preferredTopics?: string[];
}
export interface CorporateInformation {
companyInformation: CompanyInformation;
monthlyDuration: number;
payment?: {
value: number;
currency: string;
commission: number;
};
referralAgent?: string;
companyInformation: CompanyInformation;
monthlyDuration: number;
payment?: {
value: number;
currency: string;
commission: number;
};
referralAgent?: string;
}
export interface AgentInformation {
companyName: string;
commercialRegistration: string;
companyArabName?: string;
companyName: string;
commercialRegistration: string;
companyArabName?: string;
}
export interface CompanyInformation {
name: string;
userAmount: number;
name: string;
userAmount: number;
}
export interface DemographicInformation {
country: string;
phone: string;
gender: Gender;
employment: EmploymentStatus;
passport_id?: string;
timezone?: string;
country: string;
phone: string;
gender: Gender;
employment: EmploymentStatus;
passport_id?: string;
timezone?: string;
}
export interface DemographicCorporateInformation {
country: string;
phone: string;
gender: Gender;
position: string;
timezone?: string;
country: string;
phone: string;
gender: Gender;
position: string;
timezone?: string;
}
export type Gender = "male" | "female" | "other";
export type EmploymentStatus = "employed" | "student" | "self-employed" | "unemployed" | "retired" | "other";
export const EMPLOYMENT_STATUS: {status: EmploymentStatus; label: string}[] = [
{status: "student", label: "Student"},
{status: "employed", label: "Employed"},
{status: "unemployed", label: "Unemployed"},
{status: "self-employed", label: "Self-employed"},
{status: "retired", label: "Retired"},
{status: "other", label: "Other"},
];
export type EmploymentStatus =
| "employed"
| "student"
| "self-employed"
| "unemployed"
| "retired"
| "other";
export const EMPLOYMENT_STATUS: { status: EmploymentStatus; label: string }[] =
[
{ status: "student", label: "Student" },
{ status: "employed", label: "Employed" },
{ status: "unemployed", label: "Unemployed" },
{ status: "self-employed", label: "Self-employed" },
{ status: "retired", label: "Retired" },
{ status: "other", label: "Other" },
];
export interface Stat {
id: string;
user: string;
exam: string;
exercise: string;
session: string;
date: number;
module: Module;
solutions: any[];
type: string;
timeSpent?: number;
inactivity?: number;
assignment?: string;
score: {
correct: number;
total: number;
missing: number;
};
isDisabled?: boolean;
id: string;
user: string;
exam: string;
exercise: string;
session: string;
date: number;
module: Module;
solutions: any[];
type: string;
timeSpent?: number;
inactivity?: number;
assignment?: string;
score: {
correct: number;
total: number;
missing: number;
};
isDisabled?: boolean;
shuffleMaps?: ShuffleMap[];
pdf?: {
path: string;
version: string;
};
}
export interface Group {
admin: string;
name: string;
participants: string[];
id: string;
disableEditing?: boolean;
admin: string;
name: string;
participants: string[];
id: string;
disableEditing?: boolean;
}
export interface Code {
code: string;
creator: string;
expiryDate: Date;
type: Type;
creationDate?: string;
userId?: string;
email?: string;
name?: string;
passport_id?: string;
code: string;
creator: string;
expiryDate: Date;
type: Type;
creationDate?: string;
userId?: string;
email?: string;
name?: string;
passport_id?: string;
}
export type Type = "student" | "teacher" | "corporate" | "admin" | "developer" | "agent" | "mastercorporate";
export const userTypes: Type[] = ["student", "teacher", "corporate", "admin", "developer", "agent", "mastercorporate"];
export type Type =
| "student"
| "teacher"
| "corporate"
| "admin"
| "developer"
| "agent"
| "mastercorporate";
export const userTypes: Type[] = [
"student",
"teacher",
"corporate",
"admin",
"developer",
"agent",
"mastercorporate",
];