comparison service/wallscreen/gui.js @ 918:c6e6f717fabe

wallscreen show map of people and their distances from home Ignore-this: f7ff288f146881a55529d9a11585aeb4 darcs-hash:20130910073652-312f9-213c4a5fe56d3b5d9b46ddc40a4e3a2bd3d16963
author drewp <drewp@bigasterisk.com>
date Tue, 10 Sep 2013 00:36:52 -0700
parents d74460cc73da
children
comparison
equal deleted inserted replaced
917:1c3cc9633a6e 918:c6e6f717fabe
10 tasks: ko.observableArray([]), 10 tasks: ko.observableArray([]),
11 events: ko.observableArray([]), 11 events: ko.observableArray([]),
12 isToday: function (ev) { 12 isToday: function (ev) {
13 var today = moment().format("YYYY-MM-DD"); 13 var today = moment().format("YYYY-MM-DD");
14 return ev.date == today; 14 return ev.date == today;
15 } 15 },
16 mapPersonData: ko.observable(),
16 }; 17 };
17 reloadData = function() { 18 reloadData = function() {
18 $.getJSON("content", function (data) { 19 $.getJSON("content", function (data) {
19 model.tasks(data.tasks); 20 model.tasks(data.tasks);
20 model.events(data.events); 21 model.events(data.events);
21 }); 22 });
22 } 23 }
23 setInterval(reloadData, 30*60*1000); 24 setInterval(reloadData, 30*60*1000);
24 reloadData(); 25 reloadData();
26
27 reloadMap = function () {
28 $.getJSON("content/map", function (data) {
29 var personData = [];
30 data.pts.forEach(function (pt) {
31 // this is in another config but not yet in the graph
32 var initial = pt.who.split("#")[1].substr(0, 1).toUpperCase();
33 pt.initial = initial;
34 pt.topFrac = initial == 'K' ? 0 : .5;
35 personData.push(pt);
36 });
37 model.mapPersonData(personData);
38 });
39 };
40 setInterval(reloadMap, 2*60*1000);
41 reloadMap();
25 42
26 function onMessage(d) { 43 function onMessage(d) {
27 if (d.tempF) { 44 if (d.tempF) {
28 model.requestedF(d.tempF); 45 model.requestedF(d.tempF);
29 } 46 }