Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 72f4902

Browse files
t10
1 parent 3bf6121 commit 72f4902

File tree

5 files changed

+125
-3
lines changed

5 files changed

+125
-3
lines changed

my-node-server/public/index.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@
1414
<!-- <script src="./task4.js"></script> -->
1515
<!-- <script src="./task5.js"></script> -->
1616
<!-- <script src="./task6.js"></script> -->
17-
<!-- <script src="./task7.js"></script> -->
18-
<!-- <script src="./task8.js"></script> -->
19-
<script src="./task9.js"></script>
17+
<!-- <script src="./task7-w2.js"></script> -->
18+
<!-- <script src="./task8-w2.js"></script> -->
19+
<!-- <script src="./task9-w3.js"></script> -->
20+
<script src="./task10-w3.js"></script>
2021
</body>
2122
</html>

my-node-server/public/task10-w3.js

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
const modules = [
2+
{ name: 'html-css', displayName: 'HTML/CSS' },
3+
{ name: 'javascript', displayName: 'JavaScript' },
4+
{ name: 'browsers', displayName: 'Browsers' },
5+
{ name: 'using-apis', displayName: 'Using APIs' },
6+
{ name: 'node', displayName: 'Node.js' },
7+
{ name: 'databases', displayName: 'Databases' },
8+
{ name: 'react', displayName: 'React' },
9+
{ name: 'project', displayName: 'Project' },
10+
];
11+
12+
const classes = [
13+
{
14+
name: 'class32',
15+
startDate: '23-3-2021',
16+
active: false,
17+
graduationDate: '7-11-2021',
18+
},
19+
{
20+
name: 'class33',
21+
startDate: '28-5-2021',
22+
active: false,
23+
graduationDate: '7-11-2021',
24+
},
25+
{
26+
name: 'class34',
27+
startDate: '2-9-2021',
28+
active: true,
29+
currentModule: 'react',
30+
},
31+
{
32+
name: 'class35',
33+
startDate: '14-11-2021',
34+
active: true,
35+
currentModule: 'using-apis',
36+
},
37+
{
38+
name: 'class36',
39+
startDate: '5-1-2022',
40+
active: true,
41+
currentModule: 'javascript',
42+
},
43+
];
44+
45+
const students = [
46+
{ name: 'Fede', class: 'class33', gitHubName: 'fedefu', graduated: false },
47+
{ name: 'Tjebbe', class: 'class32', gitHubName: 'Tjebbee', graduated: true },
48+
{ name: 'Rob', class: 'class34', gitHubName: 'robvk', graduated: false },
49+
{
50+
name: 'Wouter',
51+
class: 'class35',
52+
gitHubName: 'wouterkleijn',
53+
graduated: false,
54+
},
55+
];
56+
57+
const mentors = [
58+
{
59+
name: 'Stas',
60+
canTeach: ['javascript', 'browsers', 'using-apis'],
61+
nowTeaching: 'javascript',
62+
},
63+
{
64+
name: 'Andrej',
65+
canTeach: ['using-apis', 'node'],
66+
},
67+
{
68+
name: 'Shriyans',
69+
canTeach: ['react'],
70+
nowTeaching: 'react',
71+
},
72+
{
73+
name: 'Yash',
74+
canTeach: ['javascript', 'using-apis'],
75+
},
76+
{
77+
name: 'Rohan',
78+
canTeach: ['html/css/git', 'javascript', 'node'],
79+
},
80+
{
81+
name: 'Collin',
82+
canTeach: ['browsers', 'using-apis', 'node'],
83+
},
84+
];
85+
86+
import { modules, students, mentors, classes } from './hyf.js';
87+
88+
/**
89+
* We would like to have a list of everyone that is currently participating in a class.
90+
* This means the students, but also the mentors that are currently teaching the class.
91+
* The students should be self explanatory, but to find the mentors you will need to follow these steps:
92+
* - Check what the `currentModule` of the class is
93+
* - Find the mentor(s) that are `nowTeaching` that module
94+
*
95+
* Should return the list of names and their roles. So something like:
96+
*
97+
* [{ name: 'John', role: 'student' }, { name: 'Mary', role: 'mentor' }]
98+
*/
99+
const getPeopleOfClass = (className) => {
100+
// TODO complete this function
101+
};
102+
// You can uncomment out this line to try your function
103+
// console.log(getPeopleOfClass('class34'));
104+
105+
/**
106+
* We would like to have a complete overview of the current active classes.
107+
* First find the active classes, then for each get the people of that class.
108+
*
109+
* Should return an object with the class names as properties.
110+
* Each class name property contains an array identical to the return from `getPeopleFromClass`. So something like:
111+
*
112+
* {
113+
* class34: [{ name: 'John', role: 'student' }, { name: 'Mary', role: 'mentor' }],
114+
* class35: [{ name: 'Jane', role: 'student' }, { name: 'Steve', role: 'mentor' }]
115+
* }
116+
*/
117+
const getActiveClasses = () => {
118+
// TODO complete this function
119+
};
120+
// You can uncomment out this line to try your function
121+
// console.log(getActiveClasses());
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)