Permalink
Browse files

Merge branch 'master' of github.com:chris-martin/awareoffice

  • Loading branch information...
2 parents 04e3632 + 8d05561 commit 0bd0a6fc41c2069a1e7e8ad4f056094eb6b06778 kf83 committed Mar 29, 2012
Showing with 10 additions and 3 deletions.
  1. +4 −2 python/purple.py
  2. +6 −1 web/graph.js
View
@@ -23,13 +23,15 @@ def go(self):
select tmp from tmp_event
where ts > ? and id = ?
""", (
- int((time.time() - 5) * 1000), self.id),
- )
+ int((time.time() - 5) * 1000),
+ self.id
+ ))
count = 0
sum = 0
for row in c:
count += 1
sum += float(row['tmp'])
+ sum /= 100
if count:
avg = sum / count
if avg < 22.5:
View
@@ -34,13 +34,18 @@ function update() {
dataType: 'json',
/*timeout: 1000,*/
success: function(data) {
+
+ // the data comes from the server reverse-chronological
+ data.tmp.reverse();
+ data.idle.reverse();
+
$.each(data.tmp, function(i, event) {
if (i != data.tmp.length - 1) return;
getLine(event.id)[0].append(event.ts, event.tmp / 100);
if ($.grep(data.idle, function(x) {
return x.id === event.id && Math.abs(x.ts - event.ts) < 0.5;
}).length)
- getLine(event.id)[1].append(event.ts, event.tmp / 100);
+ getLine(event.id)[1].append(event.ts, event.tmp / 100);
});
},
complete: function() {

0 comments on commit 0bd0a6f

Please sign in to comment.