Skip to content

Commit dd2db18

Browse files
more code
1 parent beb3896 commit dd2db18

File tree

6 files changed

+92
-83
lines changed

6 files changed

+92
-83
lines changed

one-time-scripts/load-students-virtual.js

Lines changed: 82 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,12 @@ const csvFilePath = './../private-data/2022updvirtual.csv';
228228
}
229229
}
230230

231-
if(studentData[student].hasOwnProperty('Team')) {
231+
/* if(studentData[student].hasOwnProperty('Team')) {
232+
// console.log(studentData[student]['Team'])
232233
for(var t in studentData[student]['Team']) {
233234
const school = schoolData['Name'];
234235
const team = studentData[student]['Team'][t];
236+
// console.log(school + " " + team)
235237
// console.log(team);
236238
if(team.includes("7th")) {
237239
const row = await competitionsTable.read({
@@ -247,6 +249,10 @@ const csvFilePath = './../private-data/2022updvirtual.csv';
247249
// Never hurts to check for null
248250
const schoolTeam = school + team.slice(0, -2);
249251
252+
// console.log(row)
253+
// console.log(studentRow)
254+
// console.log(schoolTeam)
255+
250256
if(teamData.hasOwnProperty(schoolTeam)) {
251257
// Switch in person
252258
if(team.charAt(team.length - 1) === '1') {
@@ -298,88 +304,89 @@ const csvFilePath = './../private-data/2022updvirtual.csv';
298304
}
299305
}
300306
}
301-
}
307+
} */
302308

303309
if(studentData[student].hasOwnProperty('Creative Thinking')) {
304-
for(var t in studentData[student]['Creative Thinking']) {
305-
const school = schoolData['Name'];
306-
const team = studentData[student]['Creative Thinking'][t];
307-
// console.log(team);
308-
if(team.includes("Seventh")) {
309-
const row = await competitionsTable.read({
310-
filterByFormula: 'Name = "Division ' + schoolData['Division'] + ' 7th Grade Creative Thinking"',
311-
maxRecords: 1
312-
});
313-
314-
const studentRow = await studentsTable.read({
315-
filterByFormula: 'Name = "' + student + '"',
316-
maxRecords: 1
317-
});
318-
319-
// Never hurts to check for null
320-
const schoolTeam = school + team.slice(0, -2);
321-
322-
if(teamData.hasOwnProperty(schoolTeam)) {
323-
// Switch in person
324-
if(team.charAt(team.length - 1) === '1') {
325-
const temp = teamData[schoolTeam]['Students'][0];
326-
327-
teamData[schoolTeam]['Students'][0] = studentRow[0]['id'];
328-
teamData[schoolTeam]['Students'].push(temp);
329-
}
330-
else {
331-
teamData[schoolTeam]['Students'].push(studentRow[0]['id']);
332-
}
333-
}
334-
else if(schoolTeam != '') {
335-
teamData[schoolTeam] = {};
336-
teamData[schoolTeam]['Competition'] = [row[0]['id']];
337-
teamData[schoolTeam]['Students'] = [studentRow[0]['id']];
338-
}
339-
}
340-
else {
341-
const row = await competitionsTable.read({
342-
filterByFormula: 'Name = "Division ' + schoolData['Division'] + ' 8th Grade Creative Thinking"',
343-
maxRecords: 1
344-
});
345-
346-
const studentRow = await studentsTable.read({
347-
filterByFormula: 'Name = "' + student + '"',
348-
maxRecords: 1
349-
});
350-
351-
// Never hurts to check for null
352-
const schoolTeam = school + team.slice(0, -2);
353-
354-
if(teamData.hasOwnProperty(schoolTeam)) {
355-
// Switch in person if necessary
356-
if(team.charAt(team.length - 1) === '1') {
357-
const temp = teamData[schoolTeam]['Students'][0];
358-
359-
teamData[schoolTeam]['Students'][0] = studentRow[0]['id'];
360-
teamData[schoolTeam]['Students'].push(temp);
361-
}
362-
else {
363-
teamData[schoolTeam]['Students'].push(studentRow[0]['id']);
364-
}
365-
}
366-
else if(schoolTeam != '') {
367-
teamData[schoolTeam] = {};
368-
teamData[schoolTeam]['Competition'] = [row[0]['id']];
369-
teamData[schoolTeam]['Students'] = [studentRow[0]['id']];
370-
}
310+
for(var t in studentData[student]['Creative Thinking']) {
311+
const school = schoolData['Name'];
312+
const team = studentData[student]['Creative Thinking'][t];
313+
// console.log(team);
314+
if(team.includes("Seventh")) {
315+
const row = await competitionsTable.read({
316+
filterByFormula: 'Name = "Division ' + schoolData['Division'] + ' Creative Thinking"',
317+
maxRecords: 1
318+
});
319+
320+
const studentRow = await studentsTable.read({
321+
filterByFormula: 'Name = "' + student + '"',
322+
maxRecords: 1
323+
});
324+
325+
// Never hurts to check for null
326+
const schoolTeam = school + team.slice(0, -15);
327+
328+
if(teamData.hasOwnProperty(schoolTeam)) {
329+
// Switch in person
330+
if(team.charAt(team.length - 1) === '1') {
331+
const temp = teamData[schoolTeam]['Students'][0];
332+
333+
teamData[schoolTeam]['Students'][0] = studentRow[0]['id'];
334+
teamData[schoolTeam]['Students'].push(temp);
335+
}
336+
else {
337+
teamData[schoolTeam]['Students'].push(studentRow[0]['id']);
338+
}
339+
}
340+
else if(schoolTeam != '') {
341+
teamData[schoolTeam] = {};
342+
teamData[schoolTeam]['Competition'] = [row[0]['id']];
343+
teamData[schoolTeam]['Students'] = [studentRow[0]['id']];
344+
}
345+
}
346+
else {
347+
const row = await competitionsTable.read({
348+
filterByFormula: 'Name = "Division ' + schoolData['Division'] + ' Creative Thinking"',
349+
maxRecords: 1
350+
});
351+
352+
const studentRow = await studentsTable.read({
353+
filterByFormula: 'Name = "' + student + '"',
354+
maxRecords: 1
355+
});
356+
357+
// Never hurts to check for null
358+
const schoolTeam = school + team.slice(0, -14);
359+
console.log(schoolTeam)
360+
361+
if(teamData.hasOwnProperty(schoolTeam)) {
362+
// Switch in person if necessary
363+
if(team.charAt(team.length - 1) === '1') {
364+
const temp = teamData[schoolTeam]['Students'][0];
365+
366+
teamData[schoolTeam]['Students'][0] = studentRow[0]['id'];
367+
teamData[schoolTeam]['Students'].push(temp);
368+
}
369+
else {
370+
teamData[schoolTeam]['Students'].push(studentRow[0]['id']);
371+
}
372+
}
373+
else if(schoolTeam != '') {
374+
teamData[schoolTeam] = {};
375+
teamData[schoolTeam]['Competition'] = [row[0]['id']];
376+
teamData[schoolTeam]['Students'] = [studentRow[0]['id']];
377+
}
378+
}
371379
}
372380
}
373381
}
374382

375-
console.log(teamData);
376-
377-
for(var record in teamData) {
378-
// await testsTable.create(teamData[record]);
379-
}
383+
console.log(teamData);
380384

381-
// console.log(teamData);
385+
for(var record in teamData) {
386+
await testsTable.create(teamData[record]);
382387
}
388+
389+
// console.log(teamData);
383390
}
384391
catch (e) {
385392
console.error(e);

schedule.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,8 @@ module.exports = (app, { eventsTable, studentsTable, schoolsTable, testsTable, a
102102
primary: student.fields.Name,
103103
secondary: "JHMC 2022", // Goes in the <title>
104104
schoolName: school.fields.Name,
105-
helpLink: nonTestingRooms.find(room => room.fields.ID == "help").fields["Zoom Link"],
105+
// helpLink: nonTestingRooms.find(room => room.fields.ID == "help").fields["Zoom Link"],
106+
helpLink: "https://zoom.us/j/97978208692?pwd=OXFEREZJekVsQ1diRVNwNllFRlk0dz09",
106107
divisionText: "Division " + school.fields.Division,
107108
// alertsHtml: "hi",
108109
alertsHtml
@@ -138,7 +139,8 @@ module.exports = (app, { eventsTable, studentsTable, schoolsTable, testsTable, a
138139
primary: "Coaches Schedule",
139140
secondary: "JHMC 2022", // Goes in the <title>
140141
schoolName: "",
141-
helpLink: nonTestingRooms.find(room => room.fields.ID == "help").fields["Zoom Link"],
142+
// helpLink: nonTestingRooms.find(room => room.fields.ID == "help").fields["Zoom Link"],
143+
helpLink: "https://zoom.us/j/97978208692?pwd=OXFEREZJekVsQ1diRVNwNllFRlk0dz09",
142144
divisionText: "",
143145
alertsHtml
144146
});
@@ -169,7 +171,8 @@ module.exports = (app, { eventsTable, studentsTable, schoolsTable, testsTable, a
169171
primary: "Parents Schedule",
170172
secondary: "JHMC 2022", // Goes in the <title>
171173
schoolName: "",
172-
helpLink: nonTestingRooms.find(room => room.fields.ID == "help").fields["Zoom Link"],
174+
// helpLink: nonTestingRooms.find(room => room.fields.ID == "help").fields["Zoom Link"],
175+
helpLink: "https://zoom.us/j/97978208692?pwd=OXFEREZJekVsQ1diRVNwNllFRlk0dz09",
173176
divisionText: "",
174177
alertsHtml
175178
});

tests.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ const getOrderedQuestions = async (record, competitionCode, competitionId) => {
6363
}
6464

6565
const validateTime = (competition, record, allowExtra=false) => {
66-
return "true";
66+
// TODO: turn off
67+
// return "true";
6768

6869
if (record.id === sampleTestId) {
6970
return "true";

views/pages/links.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
Have a question? Join the <a href="<%= helpLink %>">JHMC help room</a>.
9292
<% } else { %>
9393
Having a problem? First try <a href="javascript:window.location.reload(true);">reloading this
94-
page</a> and contacting your proctor.
94+
page</a> <!-- (irrelevant rn) and contacting your proctor -->.
9595
If the problem persists, join the <a href="<%= helpLink %>">technical help room</a>.
9696
<% } %>
9797
</p>

views/pages/tests.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
</p>
8282
<p>
8383
If you encounter any technical difficulties, private message your
84-
proctor on Zoom.
84+
proctor on Zoom who will contact the JHMC team.
8585
</p>
8686
<div id="infoDiv" style="display: none">
8787
<hr />

views/partials/footer.ejs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232
</div> -->
3333
</div>
3434
<div class="container">
35-
<p class="m-0 text-center text-white small">Having technical trouble? Visit <a href="https://bit.ly/jhmchelp">bit.ly/jhmchelp</a>
36-
for support. Link will be active from 7AM to 9PM CST on 03/12/22.</p>
3735
<p class="m-0 text-center text-white small">Copyright &copy; JHMC 2022</p>
3836
</div>
3937

0 commit comments

Comments
 (0)