Skip to content

Commit

Permalink
Merge branch 'master' of github.com:chris-martin/awareoffice
Browse files Browse the repository at this point in the history
  • Loading branch information
kf83 authored and kf83 committed Mar 29, 2012
2 parents 04e3632 + 8d05561 commit 0bd0a6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions python/purple.py
Expand Up @@ -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:
Expand Down
7 changes: 6 additions & 1 deletion web/graph.js
Expand Up @@ -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() {
Expand Down

0 comments on commit 0bd0a6f

Please sign in to comment.