diff --git a/app/client/alarm.html b/app/client/alarm.html
index e9cbbed..590d792 100644
--- a/app/client/alarm.html
+++ b/app/client/alarm.html
@@ -7,6 +7,14 @@
{{ pretty_reasons alarmReasons }}
+
+ {{/if}}
+ {{#if alarmStopped}}
+ {{ pretty_reasons alarmReasons }}
+
+
Alarm prekinut! Nadzor će se nastaviti kada se temperatura vrati u zadani raspon.
+
+
{{/if}}
{{/with}}
{{#with last_reading}}
diff --git a/app/client/alarm.js b/app/client/alarm.js
index 97a1a0a..a7d897c 100644
--- a/app/client/alarm.js
+++ b/app/client/alarm.js
@@ -1,30 +1,7 @@
-function sensor_data_collection() {
- var controllerId = Session.get('controller_id');
- return SensorData.find({
- controllerId: controllerId
- }, {
- sort: {
- created_at: -1
- },
- limit: 3
- });
-}
-function last_sensor_reading() {
- var controller = Session.get('controller_id');
- var result = null;
- if (controller) {
- result = sensor_data_collection();
- }
- if (result && result.count() > 0) {
- return result.fetch()[0];
- } else {
- return {}
- }
-}
Template.alarm.helpers({
- last_reading: last_sensor_reading,
+ last_reading: Meteor.zoblak.client.last_sensor_reading,
state: function() {
return Meteor.zoblak.client.controller_state().state;
},
@@ -33,10 +10,12 @@ Template.alarm.helpers({
},
all_temperatures: function() {
var result = "";
- var temperatures = last_sensor_reading().temperatures;
+ var temperatures = Meteor.zoblak.client.last_sensor_reading().temperatures;
for (var i in temperatures) {
- result += '' + parseFloat(temperatures[i]).toFixed(1) + ' °C ';
+ var temperature = parseFloat(temperatures[i]).toFixed(1);
+ var temperatureLabel = (Meteor.zoblak.shared.valid_temperature(temperature)) ? temperature : "XX.X";
+ result += '' + temperatureLabel + ' °C ';
}
return result;
},
diff --git a/app/client/alarm_settings.html b/app/client/alarm_settings.html
index 30156f8..572dc26 100644
--- a/app/client/alarm_settings.html
+++ b/app/client/alarm_settings.html
@@ -71,7 +71,27 @@
+
+
+
+