-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.mjs
More file actions
186 lines (152 loc) · 3.54 KB
/
Copy pathmain.mjs
File metadata and controls
186 lines (152 loc) · 3.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
import {SubjectsModel} from './school';
import {LMSModel} from './school';
import {TeachersModel} from './school';
import {PupilsModel} from './school';
import {GroupsModel} from './school';
import {GradeBooksModel} from './school';
// $$ SubjectModel And LMSModel
const history = new SubjectsModel({
title: 'History',
lessons: 24,
description: 'My desc'
});
// console.log(history.id);
const lms = new LMSModel();
lms.add(history);
// // lms.remove(history);
// console.log(lms.readAll());
// console.log(lms.verify(history));
// $$ TeachersModel $$
let data = {
"name": {
"first": "fasf",
"last": "asf"
},
"image": "string",
"dateOfBirth": "string", // format date
"emails": [
{
"email": "some",
"primary": true
}
],
"phones": [
{
"phone": "string",
"primary": false
}
],
"sex": "string", // male or female
"subjects": [
{
"subject": "string"
}
],
"description": "string",
};
// let updatedProfile = {
// "name": {
// "first": "vaskaa",
// "last": "asf"
// },
// "image": "string",
// "dateOfBirth": "string", // format date
// "emails": [
// {
// "email": "some",
// "primary": true
// }
// ],
// "phones": [
// {
// "phone": "string",
// "primary": false
// }
// ],
// "sex": "string", // male or female
// "subjects": [
// {
// "subject": "string"
// }
// ],
// "description": "string",
// };
const teachers = new TeachersModel();
const teacherId = teachers.add(data);
// const updateTeacher = teachers.update(teacherId, updatedProfile);
// teachers.remove(teacherId)
// console.log(teachers.read(teacherId));
// console.log(teacherId);
// $$PupilsModule$$
let pupilData= {
"name": {
"first": "george",
"last": "string"
},
"image": "string",
"dateOfBirth": "string", // format date
"phones": [
{
"phone": "string",
"primary": true
}
],
"sex": "string", // male OR female
"description": "string"
};
let updatePupilData= {
"name": {
"first": "george",
"last": "bvas"
},
"image": "string",
"dateOfBirth": "string", // format date
"phones": [
{
"phone": "string",
"primary": true
}
],
"sex": "string", // male OR female
"description": "string"
};
const pupils = new PupilsModel();
const pupil = pupils.add(pupilData);
// console.log(pupil.id);
// pupils.update(pupil.id, updatePupilData);
// pupils.remove(pupil.id)
// console.log(pupils.read(pupil.id));
// $$GroupModule$$
const room = 236;
const groups = new GroupsModel();
const groupId = groups.add(room);
// console.log(groupId);
groups.addPupil(groupId, pupil);
groups.removePupil(groupId, pupil.id);
// groups.update(groupId, {
// room: 237
// });
// groups.read(groupId)
// groups.readAll();
// console.log(groups.read(groupId));
// $$Gradebook$$
const pupilId = pupil.id;
const teachersId = teacherId;
const gradebooks = new GradeBooksModel(groups, teachers, lms);
const level = 1;
const gradebook = gradebooks.add(level, groupId);
console.log(gradebook);
const record = {
pupilId: pupilId,
teacherId: teachersId,
subjectId: history.id,
lesson: 1,
mark: 9
};
console.log(gradebooks.addRecord(gradebook, record));
// Read information about oliver results
const oliver = gradebooks.read(gradebook, pupilId);
console.log(oliver);
// Read information about all students in this gradebook
const students = gradebooks.readAll(gradebook); // It will return the array of objects
console.log(students);