Files
old-tfm/app/client/log.js

37 lines
771 B
JavaScript
Raw Normal View History

2016-02-28 10:05:14 +01:00
function sensor_data_collection() {
var controllerId = Session.get('controller_id');
return SensorData.find({
controllerId: controllerId
}, {
sort: {
created_at: -1
2016-02-28 11:19:18 +01:00
},
limit: 100
2016-02-28 10:05:14 +01:00
});
}
Template.log.helpers({
2016-02-28 10:05:14 +01:00
sensorDataCollection: sensor_data_collection
});
Template.log.events({
'click clear_log': function() {
Meteor.call('clearLog');
}
});
Template.sensorData.helpers({
created_at_formatted: function() {
return moment(this.created_at).format("DD.MM.YYYY, HH:mm")
2016-10-29 13:07:08 +02:00
},
all_temperatures: function(temperatures) {
var result = '';
if (temperatures.length > 0) {
for (var i in temperatures) {
result += '' + parseFloat(temperatures[i]).toFixed(1) + ' °C ';
}
}
return result;
}
});