I have a PHP file with the following script in it that I think is where the issue lies. The PHP file is to check for event information and post the event and times on a display board. It does this check every 5 minutes
What is happening is that it is appending the new information to the previous information instead of overwriting/refreshing it.
So the output every 5 minutes would look similar to the following (without the *5 minutes later):
12:00-1:00pm Lunch 12:00-1:00pm Lunch *5 minutes later 12:00-1:00pm Lunch *5 minutes later ...
The checks every 5 minutes needs to happen in case events get updated or changed. As you can see from the above, it appends instead of overwrites.
Here is the section of code I believe where the issue lies in how the array is handled.
function init_event(){
$.ajax({
url:"php/event-query.php",
data:{activeId:SETTING_DATA.facility},success:function(e){
var t=JSON.parse(e),n=Date.now()/1e3|0;
if(!SETTING_DATA.show_passed_events)
for(var i in t)
t.hasOwnProperty(i)&&n>t[i].time_to&&delete t[i];
if($.isEmptyObject(t))$("#event-text").css("display","block"),$("#event-table").css("display","none");
else{
$("#event-text").css("display","none"),$("#event-table").css("display","table");
var o,a=Math.floor(window.innerHeight/window.innerWidth*9),l=document.getElementById("event-table-body"),c="#000000",r=1/((r=Object.keys(t).length)<=a?r:a),d=0;
for(o in t)
if(t.hasOwnProperty(o)){
var s=document.createElement("tr"), m=t[o].time_from,u=t[o].time_to,_=document.createElement("td");
_.appendChild(document.createTextNode(format_time(m,u))),s.appendChild(_);
_=document.createElement("td");
if(_.appendChild(document.createTextNode(t[o].name)),s.appendChild(_),s.style.color=c,s.style.color=m<n&&n<u&&SETTING_DATA.highlight_current?"#4da6ff":c,l.appendChild(s),c=shadeColour(c,r*++d/1.5-.1),d==a)break}}}}),setTimeout(function(){
init_event()
},3e5
)
}