diff --git a/public/home.html b/public/home.html index 3147a557..331b59bf 100755 --- a/public/home.html +++ b/public/home.html @@ -42,6 +42,8 @@ + + diff --git a/public/home.js b/public/home.js index 3a7a6020..c15ff252 100755 --- a/public/home.js +++ b/public/home.js @@ -890,27 +890,7 @@ function responseCallbackPartial(response) { //let periods = ["Period 1", "CM/OTI", "Period 2", "Period 3", "Period 4"]; let periods = tableData.schedule.black.slice().map(x => x.aspenPeriod.substring(x.aspenPeriod.indexOf("-") + 1)); - var per3 = tableData.schedule.black[3];//right now only decides lunch based on black day... - var floor = per3.room[0]; - var zone = per3.room[1]; - console.log("zone: " + zone + " floor: " + floor); - let lunch = 0; - - - //-------LOGIC TO DECIDE LUNCH (THIS WILL NEED TO BE UPDATED)--------------- - if ((zone < 6 && floor < 3) && (!per3.name.includes("Bio") && !per3.name.includes("Chem") && !per3.name.includes("Physics") && !per3.name.includes("Science"))) { - lunch = 1; - } - if((zone < 6 && floor > 3) || zone == 6) { - lunch = 2; - } - if (zone < 6 && floor == 3 || per3.name.includes("Bio") || per3.name.includes("Chem") || per3.name.includes("Physics") || per3.name.includes("Science") || per3.name.includes("PE")) {//(Rindge 3rd floor, VPA in Arts Building (NOT ACCOUNTED FOR), Science, War Memorial == C - lunch = 3; - } - else { - lunch = 0; - } -//---------END LUNCH LOGIC---------- + lunch = lunchTime(); if (lunch == 1) {//Lunch A diff --git a/public/js/clock.js b/public/js/clock.js index 54a82bef..7c39a817 100755 --- a/public/js/clock.js +++ b/public/js/clock.js @@ -108,6 +108,15 @@ function update_lunch() { redraw_clock(); } + +function updateClockLunch(lunch) { + + current_schedule = lunch; + console.log("here"); +} + + + // Takes an object with "room" and "id" function get_schedule(p3room, p3id) { var floor = Math.floor(p3room / 1000); @@ -167,6 +176,13 @@ function school_day() { } function redraw_clock() { + + var lunch = lunchTime(); + + if(lunch != 0) {//If correct lunch time can be isolated.. + document.getElementById("lunch_range").value = lunch - 1; + + } // Fake call to get_period_name to set current_schedule get_period_name("Period 1"); // UTC to EST @@ -221,7 +237,7 @@ function redraw_clock() { number += 12 * 60 * 60 * 1000; } } - + // conver 0-1 to 0-2pi pos = pos * 2 * Math.PI; @@ -234,4 +250,43 @@ function redraw_clock() { drawName(period_name); drawHand(large_ctx, large_radius, pos, large_radius * .94, large_radius * .095); drawNumber(large_ctx, large_radius, pos, number); + + } + + + + +function lunchTime() { + var per3 = tableData.schedule.black[3];//right now only decides lunch based on black day... + var floor = per3.room[0]; + var zone = per3.room[1]; + console.log("zone: " + zone + " floor: " + floor); + let lunch = 0; + + + //-------LOGIC TO DECIDE LUNCH (THIS WILL NEED TO BE UPDATED)--------------- + if ((zone < 6 && floor < 3) && (!per3.name.includes("Bio") && !per3.name.includes("Chem") && !per3.name.includes("Physics") && !per3.name.includes("Science"))) { + lunch = 1; + updateClockLunch("regular-a");//Update Clock; + } + if((zone < 6 && floor > 3) || zone == 6) { + lunch = 2; + updateClockLunch("regular-b");//Update Clock; + + } + if (zone < 6 && floor == 3 || per3.name.includes("Bio") || per3.name.includes("Chem") || per3.name.includes("Physics") || per3.name.includes("Science") || per3.name.includes("PE")) {//(Rindge 3rd floor, VPA in Arts Building (NOT ACCOUNTED FOR), Science, War Memorial == C + lunch = 3; + updateClockLunch("regular-c");//Update Clock; + + } + else { + lunch = 0; + } +//---------END LUNCH LOGIC---------- + + return lunch; + } + + + diff --git a/public/js/extraFunctions.js b/public/js/extraFunctions.js index 0dd56c4f..20f878ad 100755 --- a/public/js/extraFunctions.js +++ b/public/js/extraFunctions.js @@ -859,3 +859,36 @@ let anyEdited = function() { return finalDecision; } +function lunchTime() { + var per3 = tableData.schedule.black[3];//right now only decides lunch based on black day... + var floor = per3.room[0]; + var zone = per3.room[1]; + console.log("zone: " + zone + " floor: " + floor); + let lunch = 0; + + + //-------LOGIC TO DECIDE LUNCH (THIS WILL NEED TO BE UPDATED)--------------- + if ((zone < 6 && floor < 3) && (!per3.name.includes("Bio") && !per3.name.includes("Chem") && !per3.name.includes("Physics") && !per3.name.includes("Science"))) { + lunch = 1; + updateClockLunch("regular-a");//Update Clock; + } + if((zone < 6 && floor > 3) || zone == 6) { + lunch = 2; + updateClockLunch("regular-b");//Update Clock; + + } + if (zone < 6 && floor == 3 || per3.name.includes("Bio") || per3.name.includes("Chem") || per3.name.includes("Physics") || per3.name.includes("Science") || per3.name.includes("PE")) {//(Rindge 3rd floor, VPA in Arts Building (NOT ACCOUNTED FOR), Science, War Memorial == C + lunch = 3; + updateClockLunch("regular-c");//Update Clock; + + } + else { + lunch = 0; + } +//---------END LUNCH LOGIC---------- + // redraw_clock();//Redraw Clock based on lunch + + return lunch; + } + +