-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfrontPageOld.js
More file actions
125 lines (116 loc) · 3.32 KB
/
frontPageOld.js
File metadata and controls
125 lines (116 loc) · 3.32 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
$("#ScheduleButton").click(function() {
var studentInputs = ["#studentsInput-1", "#studentsInput-2", "#studentsInput-3", "#studentsInput-4"];
var monitorInputs = ["#monitorsInput-1", "#monitorsInput-2", "#monitorsInput-3", "#monitorsInput-4"];
var students = {};
var monitors = {};
for (var i = 0; i < studentInputs.length; i++) {
students['div'+(i+1)] = $(studentInputs[i]).val().split("/n");
var divInStudents = students['div'+(i+1)];
for (var k = 0; k < divInStudents.length; k++) {
if (divInStudents[k].length < 4) {
alert("Every name should include a first and last name");
};
};
monitors['div'+(i+1)] = $(monitorInputs[i]).val().split("/n");
var studentNames = $(studentInputs[i]).val().split("/n");
var monitorNames = $(monitorInputs[i]).val().split("/n");
};
console.log(students.div1);
var schedule = {};
for (var div in students) /*for/in loop 1*/{
schedule[div]={};
var studentsArray = students[div];
for (var i = 0; i < studentsArray.length; i++) /*for loop 1*/{
for (var i = 0; i < studentNames.length; i++) {
schedule[div]['student'+i] = studentsArray[i];
i++;
schedule[div]['student'+i] = studentsArray[i];
};
console.log(div);
console.log('student'+i);
};
};
for (var div in monitors) /*for/in loop 2*/{
var monitorsArray = monitors[div];
for (var i = 0; i < monitorsArray.length; i++) /*for loop 2*/{
schedule[div]['monitor'+i] = monitorsArray[i];
};
};
console.log(schedule);
console.log(studentsArray[1]);
//Validations
var S1 = $("#studentsInput-1").val();
var S2 = $("#studentsInput-2").val();
var S3 = $("#studentsInput-3").val();
var S4 = $("#studentsInput-4").val();
var M1 = $("#monitorsInput-1").val();
var M2 = $("#monitorsInput-2").val();
var M3 = $("#monitorsInput-3").val();
var M4 = $("#monitorsInput-4").val();
if((S1.length < 4) || (S2.length < 4) || (S3.length < 4) || (S4.length < 4)) {
alert("Text field empty");
}
if (M1.length > S1.length/2) {
alert("Too many monitors in in division 1");
};
if (M2.length > S2.length/2) {
alert("Too many monitors in in division 2");
};
if (M3.length > S3.length/2) {
alert("Too many monitors in in division 3");
};
if (M4.length > S4.length/2) {
alert("Too many monitors in in division 4");
};
if (M1.length < S1.length/2) {
alert("Need more monitors in in division 1");
};
if (M2.length < S2.length/2) {
alert("Need more monitors in in division 2");
};
if (M3.length < S3.length/2) {
alert("Need more monitors in in division 3");
};
if (M4.length < S4.length/2) {
alert("Need more monitors in in division 4");
};
for(var div in students){
for (var i = 0; i < div.length; i++) {
if (students[div]['students'+i] < 4){
alert("Every name should include a first and last name");
console.log(students[div]['students'+i])
};
};
};
if (monitorNames) {};
});
var divisions = {
first:{
game1:"Calla",
game2:"Shape-up",
game3:"Kings & Quads",
game4:"Hex-A-Gone",
game5:"Star Track"
},
second:{
game1:"Fiar",
game2:"Sum Dominoes & Dice",
game3:"Quatro Sinko",
game4:"Par 55",
game5:"Ramrod"
},
third:{
game1:"Fab-A-Diffy",
game2:"Stars & Bars",
game3:"Contig 60",
game4:"Queens & Guards",
game5:"Juggle"
},
fourth:{
game1:"Fraction Pinball",
game2:"Pent Em' In",
game3:"Prime Gold",
game4:"Remainder Islands",
game5:"Frac Fact"
}
}