Programa basic acabat, funciona
diff --git a/completeHTML.js b/completeHTML.js
index 38ee27a..7ea0067 100644
--- a/completeHTML.js
+++ b/completeHTML.js
@@ -3,10 +3,8 @@
document.getElementById("data").innerHTML = data;
var trobat = false;
for (i = 0; i < dataHorarisAlumne.length; i++) {
- var h = dataHorarisAlumne[i].hora.split(":");
+ var h = dataHorarisAlumne[i].hora[hora_actual.getDay()].split(":");
var hAct = hora_actual.getHours() - 1;
- console.log(h[0]);
- console.log(hAct);
if(hAct < 10) hAct = "0" + hAct;
if(h[0] == hAct) {
trobat = true;
diff --git a/completeLink.js b/completeLink.js
index e3b63bb..2536000 100644
--- a/completeLink.js
+++ b/completeLink.js
@@ -2,10 +2,10 @@
function completaLink() {
if(linkOutput == "") linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform";
for (i = 0; i < dataHorarisAlumne.length; i++) {
- var h = dataHorarisAlumne[i].hora.split(":");
+ var h = dataHorarisAlumne[i].hora[hora_actual.getDay()].split(":");
console.log(h[0]);
console.log((hora_actual.getHours()).toString());
- var hAct = hora_actual.getHours();
+ var hAct = hora_actual.getHours() - 1;
if(hAct < 10) hAct = "0" + hAct;
if(h[0] == hAct) {
console.log("trobat");
@@ -22,4 +22,29 @@
window.location.href = linkOutput + "?"+ datamap[1] + "&" + datamap[2] + "&" + datamap[3] + "&" + datamap[0] + "&" + datamap[4] + "&entry." + codisFiles[document.getElementById("seientInput").value.toUpperCase().charCodeAt(0) - 65] + "=Columna+" + document.getElementById("seientInput").value.charAt(1) + "&entry.1600275159=[Autogenerat+per+delefme/covid-tracability]";
}
}
+}
+
+function completaLinkNoAnatClasse() {
+ if(linkOutput == "") linkOutput = "https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform";
+ for (i = 0; i < dataHorarisAlumne.length; i++) {
+ var h = dataHorarisAlumne[i].hora[hora_actual.getDay()].split(":");
+ console.log(h[0]);
+ console.log((hora_actual.getHours()).toString());
+ var hAct = hora_actual.getHours() - 1;
+ if(hAct < 10) hAct = "0" + hAct;
+ if(h[0] == hAct) {
+ console.log("trobat");
+ document.getElementById("assignatura").innerHTML = dataHorarisAlumne[i].nom;
+ document.getElementById("aula").innerHTML = "Aula " + dataHorarisAlumne[i].aula;
+
+ var datamap=[
+ "entry.1063142948=" + dataHorarisAlumne[i].aula,
+ "entry.1749141911=" + ((hora_actual.getHours() - 11).toString()) +":00",
+ "entry.1827359679=" + ((hora_actual.getHours() - 10).toString()) +":00",
+ "entry.2115504093=" + getYearFormat() + '-' + getMonthFormat() + '-' + getDayFormat(),
+ "entry.1077148310=Columna+" + document.getElementById("seientInput").value
+ ];
+ window.location.href = linkOutput + "?"+ datamap[1] + "&" + datamap[2] + "&" + datamap[3] + "&" + datamap[0] + "&entry." + codisFiles[document.getElementById("seientInput").value.toUpperCase().charCodeAt(0) - 65] + "=Columna+" + document.getElementById("seientInput").value.charAt(1) + "&entry.1600275159=___No_he_assistit_a_aquesta_classe___[Autogenerat+per+delefme/covid-tracability]";
+ }
+ }
}
\ No newline at end of file
diff --git a/completeSubjectListInHTML.js b/completeSubjectListInHTML.js
index 1264ae1..24ae8d9 100644
--- a/completeSubjectListInHTML.js
+++ b/completeSubjectListInHTML.js
@@ -1,20 +1,37 @@
function completeSubjectList() {
var trobat = false;
+ var jaEsta = false;
for(var i = 0; i < totesLesClasses.length; i++) {
+
if(document.getElementById("myInput").value == totesLesClasses[i].nom) {
- dataHorarisAlumne.push({ "nom":totesLesClasses[i].nom, "hora":totesLesClasses[i].hora, "aula":totesLesClasses[i].aula })
- document.getElementById("subjectList").innerHTML += "<br>" + document.getElementById("myInput").value + " " + dataHorarisAlumne[i].hora;
- localStorage.dataHorarisAlumne = JSON.stringify(dataHorarisAlumne);
- trobat = true;
- completaHTML();
+ for(var j = 0; j < dataHorarisAlumne.length; j++) {
+ if(totesLesClasses[i].nom == dataHorarisAlumne[j].nom) {
+ jaEsta = true;
+ break;
+ }
+ }
+ if(!jaEsta) {
+ dataHorarisAlumne.push({ "nom":totesLesClasses[i].nom, "hora":totesLesClasses[i].hora, "aula": totesLesClasses[i].aula })
+ document.getElementById("subjectList").innerHTML += "<br>" + document.getElementById("myInput").value + " " + totesLesClasses[i].hora[hora_actual.getDay()];
+ localStorage.dataHorarisAlumne = JSON.stringify(dataHorarisAlumne);
+ trobat = true;
+ completaHTML();
+ }
+ else {
+ break;
+ }
}
}
- if(!trobat) {
+ if(!trobat && !jaEsta) {
showAlert();
}
+ else if(jaEsta) {
+
+ }
}
+
function returnAllSubjectArray() {
for(var i = 0; i < totesLesClasses.length; i++) {
subjects.push(totesLesClasses[i].nom);
@@ -23,8 +40,7 @@
function writeSubjectList() {
for(var i = 0; i < dataHorarisAlumne.length; i++) {
- console.log("hola");
- document.getElementById("subjectList").innerHTML += "<br>" + dataHorarisAlumne[i].nom + " " + dataHorarisAlumne[i].hora;
+ document.getElementById("subjectList").innerHTML += "<br>" + dataHorarisAlumne[i].nom + " " + dataHorarisAlumne[i].hora[hora_actual.getDay()];
}
}
diff --git a/horaris.json b/horaris.json
index a0ca6a2..4a607ef 100644
--- a/horaris.json
+++ b/horaris.json
@@ -1 +1 @@
-classes = '[{"nom" : "Càlcul", "hora" : "08:00-9:00", "aula" : "S02"}, {"nom" : "Àlgebra Lineal", "hora" : "09:00-10:00", "aula" : "S02"}, {"nom" : "Àlgebra Multilineal", "hora" : "10:00-11:00", "aula" : "S02"}, {"nom" : "Geometria", "hora" : "11:00-12:00", "aula" : "S02"}, {"nom" : "EDOS", "hora" : "12:00-13:00", "aula" : "S02"}, {"nom" : "EDPS", "hora" : "13:00-14:00", "aula" : "S02"}, {"nom" : "Calcul Integral", "hora" : "14:00-15:00", "aula" : "S02"}, {"nom" : "Fonaments de les Matemàtiques", "hora" : "15:00-16:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL9", "hora" : "16:00-17:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL10", "hora" : "17:00-18:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL11", "hora" : "18:00-19:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL12", "hora" : "19:00-20:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL13", "hora" : "20:00-21:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL14", "hora" : "21:00-22:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL15", "hora" : "22:00-23:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL16", "hora" : "23:00-00:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL17", "hora" : "00:00-01:00", "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL18", "hora" : "01:00-02:00", "aula" : "S02"}]';
+classes = '[{"nom" : "Càlcul", "hora" : ["08:00-9:00", "08:00-9:00", "08:00-9:00", "08:00-9:00", "08:00-9:00", "08:00-9:00", "08:00-9:00"], "aula" : "S02"}, {"nom" : "Àlgebra Lineal", "hora" : ["09:00-10:00", "09:00-10:00", "09:00-10:00", "09:00-10:00", "09:00-10:00", "09:00-10:00", "09:00-10:00"], "aula" : "S02"}, {"nom" : "Àlgebra Multilineal", "hora" : ["10:00-11:00", "10:00-11:00", "10:00-11:00", "10:00-11:00", "10:00-11:00", "10:00-11:00", "10:00-11:00"], "aula" : "S02"}, {"nom" : "Geometria", "hora" : ["11:00-12:00", "11:00-12:00", "11:00-12:00", "11:00-12:00", "11:00-12:00", "11:00-12:00", "11:00-12:00"], "aula" : "S02"}, {"nom" : "EDOS", "hora" : ["12:00-13:00", "12:00-13:00", "12:00-13:00", "12:00-13:00", "12:00-13:00", "12:00-13:00", "12:00-13:00"] , "aula" : "S02"}, {"nom" : "EDPS", "hora" : ["13:00-14:00", "13:00-14:00", "13:00-14:00", "13:00-14:00", "13:00-14:00", "13:00-14:00", "13:00-14:00"], "aula" : "S02"}, {"nom" : "Calcul Integral", "hora" : ["14:00-15:00", "14:00-15:00", "14:00-15:00", "14:00-15:00", "14:00-15:00", "14:00-15:00", "14:00-15:00"], "aula" : "S02"}, {"nom" : "Fonaments de les Matemàtiques", "hora" : ["15:00-16:00", "15:00-16:00", "15:00-16:00", "15:00-16:00", "15:00-16:00", "15:00-16:00", "15:00-16:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL9", "hora" : ["16:00-17:00", "16:00-17:00", "16:00-17:00", "16:00-17:00", "16:00-17:00", "16:00-17:00", "16:00-17:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL10", "hora" : ["17:00-18:00", "17:00-18:00", "17:00-18:00", "17:00-18:00", "17:00-18:00", "17:00-18:00", "17:00-18:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL11", "hora" : ["18:00-19:00", "18:00-19:00", "18:00-19:00", "18:00-19:00", "18:00-19:00", "18:00-19:00", "18:00-19:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL12", "hora" : ["19:00-20:00", "19:00-20:00", "19:00-20:00", "19:00-20:00", "19:00-20:00", "19:00-20:00", "19:00-20:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL13", "hora" : ["20:00-21:00", "20:00-21:00", "20:00-21:00", "20:00-21:00", "20:00-21:00", "20:00-21:00", "20:00-21:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL14", "hora" : ["21:00-22:00", "21:00-22:00", "21:00-22:00", "21:00-22:00", "21:00-22:00", "21:00-22:00", "21:00-22:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL15", "hora" : ["22:00-23:00", "22:00-23:00", "22:00-23:00", "22:00-23:00", "22:00-23:00", "22:00-23:00", "22:00-23:00"], "aula" : "S02"}, {"nom" : "ÀLGEBRA MULTILINIAL16", "hora" : ["23:00-00:00", "23:00-00:00", "23:00-00:00", "23:00-00:00", "23:00-00:00", "23:00-00:00", "23:00-00:00"], "aula" : "S02"}]';
\ No newline at end of file
diff --git a/main.html b/main.html
index 67d5b82..1052967 100644
--- a/main.html
+++ b/main.html
@@ -34,6 +34,28 @@
position:relative;
top:1px;
}
+ .myButton2 {
+ box-shadow:inset 0px 1px 0px 0px #b30000;
+ background:linear-gradient(to bottom, #ff1a1a 5%, #ff8080 100%);
+ background-color:#ff6666;
+ border:1px solid #990000;
+ display:inline-block;
+ cursor:pointer;
+ color:#ffffff;
+ font-family:Arial;
+ font-size:13px;
+ font-weight:bold;
+ padding:6px 12px;
+ text-decoration:none;
+ }
+ .myButton2:hover {
+ background:linear-gradient(to bottom, #ff8080 5%, #ff1a1a 100%);
+ background-color:#ff6666;
+ }
+ .myButton2:active {
+ position:relative;
+ top:1px;
+ }
</style>
</head>
<center>
@@ -48,7 +70,6 @@
<span id="fi"></span>
</h2>
<h3 id="data"></h3>
- <p> <br></p>
<form id="subjectListInput" autocomplete="off">
<div class="autocomplete" id="input2" style="width:300px;">
@@ -71,10 +92,12 @@
<form id = "link">
<!--<form id = "link" action = https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform?entry.1063142948=S03&entry.2115504093=2020-09-14&entry.1749141911=9:00&entry.1827359679=10:00&entry.208184485=Columna+3&entry.1600275159=[Autogenerat+per+delefme/covid-tracability]>-->
- <a class="myButton" type="reset" onclick="completaLink()">Continua</a>
+ <h2>
+ <a class="myButton" type="reset" onclick="completaLink()">Continua</a>
+ <a class="myButton2" onclick="completaLinkNoAnatClasse()">No he assistit a classe</a>
+ </h2>
</form>
- <p> <br></p>
<a class="myButton" href="https://docs.google.com/forms/d/e/1FAIpQLSfT9o287VqLyhwR8LPdloAQWhuqCgA3NfdhgP5vb9_sVQHL-g/viewform">Hi ha errors? Completa formulari manualment</a>
<script>
@@ -90,8 +113,6 @@
if(localStorage.dataHorarisAlumne != null) dataHorarisAlumne = JSON.parse(localStorage.dataHorarisAlumne);
- console.log(localStorage.dataHorarisAlumne);
-
//localStorage.clear();
returnAllSubjectArray();
autocomplete(document.getElementById("myInput"), subjects);