summaryrefslogtreecommitdiffstats
path: root/dist
diff options
context:
space:
mode:
authorsijanec <sijanecantonluka@gmail.com>2020-06-04 14:51:19 +0200
committersijanec <sijanecantonluka@gmail.com>2020-06-04 14:51:19 +0200
commit17094323e955995d18341d572636c959609280ac (patch)
tree7a4d209383fa141d8a407b1f2b1583e5ddec3a4f /dist
parentthis MAY fix the grades problem; not tested yet, DNM (diff)
downloadbeziapp-17094323e955995d18341d572636c959609280ac.tar
beziapp-17094323e955995d18341d572636c959609280ac.tar.gz
beziapp-17094323e955995d18341d572636c959609280ac.tar.bz2
beziapp-17094323e955995d18341d572636c959609280ac.tar.lz
beziapp-17094323e955995d18341d572636c959609280ac.tar.xz
beziapp-17094323e955995d18341d572636c959609280ac.tar.zst
beziapp-17094323e955995d18341d572636c959609280ac.zip
Diffstat (limited to '')
-rwxr-xr-xdist/js/app.js2
-rw-r--r--dist/js/grades.js5
-rwxr-xr-xdist/pages/about.html2
-rwxr-xr-xdist/sw.js4
4 files changed, 6 insertions, 7 deletions
diff --git a/dist/js/app.js b/dist/js/app.js
index 8e89709..2400241 100755
--- a/dist/js/app.js
+++ b/dist/js/app.js
@@ -3,7 +3,7 @@
const app_version = "1.0.14-beta";
-const previous_commit = "07ff5e29f0c460cd541a1bc6d65b5290ed94de61";
+const previous_commit = "4501c407bab73552c846df236a6c361a2e1b88a8";
if ("serviceWorker" in navigator) {
navigator.serviceWorker.register("/sw.js")
diff --git a/dist/js/grades.js b/dist/js/grades.js
index b1bfb3d..49f302f 100644
--- a/dist/js/grades.js
+++ b/dist/js/grades.js
@@ -2,10 +2,9 @@
let checkbox_state=false;var grades;async function checkLogin(){localforage.getItem("logged_in").then((value)=>{if(value!==true){window.location.replace("/index.html");}}).catch((err)=>{console.log(err);});}
function setLoading(state){if(state){$("#loading-bar").removeClass("hidden");}else{$("#loading-bar").addClass("hidden");}}
async function loadGrades(force_refresh=false){setLoading(true);let promises_to_run=[localforage.getItem("username").then((value)=>{username=value;}),localforage.getItem("password").then((value)=>{password=value;}),localforage.getItem("grades").then((value)=>{grades=value;})];await Promise.all(promises_to_run);if(grades==null||grades==[]||force_refresh){try{let gsecInstance=new gsec();await gsecInstance.login(username,password);gsecInstance.fetchGrades().then((value)=>{grades=value;localforage.setItem("grades",value).then(()=>{displayGrades();setLoading(false);});setLoading(false);}).catch((err)=>{gsecErrorHandlerUI(err);setLoading(false);});}catch(err){gsecErrorHandlerUI(err);setLoading(false);}}else{displayGrades();setLoading(false);}}
-function displayGrades(){let grades_by_subject={};let zakljucne_grades_by_subject={};grades.forEach((grade,index)=>{if(grade["gradeType"]!=GSEC_NORMAL_GRADE){zakljucne_grades_by_subject[grade["subject"]]=grade["grade"];break;}
-if(!(grade["subject"]in grades_by_subject)){grades_by_subject[grade["subject"]]=[];}
+function displayGrades(){let grades_by_subject={};let zakljucne_grades_by_subject={};grades.forEach((grade,index)=>{if(grade["gradeType"]!=GSEC_NORMAL_GRADE){zakljucne_grades_by_subject[grade["subject"]]=grade["grade"];}else{if(!(grade["subject"]in grades_by_subject)){grades_by_subject[grade["subject"]]=[];}
let grade_object={date:dateString.longFormatted(grade["date"]),teacher:grade["teacher"],subject:grade["subject"],title:grade["name"][0],type:grade["name"][1],term:grade["name"][2],grade:grade["grade"],temporary:grade["temporary"],index:index}
-grades_by_subject[grade["subject"]].push(grade_object);});let root_element=document.getElementById("grades-collapsible");Object.keys(grades_by_subject).forEach((subject)=>{let subject_entry=document.createElement("li");let subject_header=document.createElement("div");subject_header.classList.add("collapsible-header");subject_header.classList.add("collapsible-header-root");let subject_header_text=document.createElement("span");subject_header_text.innerText=subject;let subject_body=document.createElement("div");subject_body.className="collapsible-body";let subject_body_root=document.createElement("ul");subject_body_root.className="collection";let grade_sum=0;let grade_tot=0;grades_by_subject[subject].forEach((grade)=>{let grade_node=document.createElement("li");grade_node.className="collection-item";grade_node.classList.add("collection-item")
+grades_by_subject[grade["subject"]].push(grade_object);}});let root_element=document.getElementById("grades-collapsible");Object.keys(grades_by_subject).forEach((subject)=>{let subject_entry=document.createElement("li");let subject_header=document.createElement("div");subject_header.classList.add("collapsible-header");subject_header.classList.add("collapsible-header-root");let subject_header_text=document.createElement("span");subject_header_text.innerText=subject;let subject_body=document.createElement("div");subject_body.className="collapsible-body";let subject_body_root=document.createElement("ul");subject_body_root.className="collection";let grade_sum=0;let grade_tot=0;grades_by_subject[subject].forEach((grade)=>{let grade_node=document.createElement("li");grade_node.className="collection-item";grade_node.classList.add("collection-item")
grade_node.classList.add("grade-node");grade_node.dataset["index"]=grade["index"];let grade_node_div=document.createElement("div");let grade_text=document.createElement("span");let grade_number=document.createElement("div");grade_number.className="secondary-content";if(grade["temporary"]){let grade_text_italic=document.createElement("i");grade_text_italic.innerText=grade["date"]+" - "+grade["title"];grade_text.appendChild(grade_text_italic);let grade_number_italic=document.createElement("i");grade_number_italic.innerText=grade["grade"].toString();grade_number.appendChild(grade_number_italic);}else{grade_text.innerText=grade["date"]+" - "+grade["title"];grade_number.innerText=grade["grade"].toString();}
grade_node_div.appendChild(grade_text);grade_node_div.appendChild(grade_number);grade_node.appendChild(grade_node_div);if(!grade["temporary"]||!checkbox_state){grade_sum+=grade["grade"];grade_tot+=1;}
subject_body_root.appendChild(grade_node);});let grade_average=(grade_tot===0)?"N/A":(Math.round(((grade_sum/grade_tot)+Number.EPSILON)*100)/100);let subject_header_average=document.createElement("div");subject_header_average.className="collapsible-header-right";if(subject in zakljucne_grades_by_subject){subject_header_average.innerText=zakljucne_grades_by_subject[subject];subject_header_average.classList.add="zakljucna-grade";}else{subject_header_average.innerText=grade_average.toString();}
diff --git a/dist/pages/about.html b/dist/pages/about.html
index 84c82c7..2ae4982 100755
--- a/dist/pages/about.html
+++ b/dist/pages/about.html
@@ -142,7 +142,7 @@
<div class="row">
<p>
<small>
- ^HEAD 07ff5e29f0c460cd541a1bc6d65b5290ed94de61
+ ^HEAD 4501c407bab73552c846df236a6c361a2e1b88a8
</small>
</p>
</div>
diff --git a/dist/sw.js b/dist/sw.js
index 8021f2b..0760cb0 100755
--- a/dist/sw.js
+++ b/dist/sw.js
@@ -3,8 +3,8 @@
// Change version to cause cache refresh
-const static_cache_name = "site-static-1.0.14-beta-07ff5e2";
-// commit before the latest is 07ff5e29f0c460cd541a1bc6d65b5290ed94de61
+const static_cache_name = "site-static-1.0.14-beta-4501c40";
+// commit before the latest is 4501c407bab73552c846df236a6c361a2e1b88a8
// Got them with find . -not -path '*/\.*' | sed "s/.*/\"&\",/" | grep -v sw.js
// sw.js NE SME BITI CACHAN, ker vsebuje verzijo!