Calculation is in range message

This commit is contained in:
MilosKozak
2015-11-03 20:35:25 +01:00
parent cc62d436f2
commit 3f038a422d
3 changed files with 23 additions and 4 deletions
+13 -4
View File
@@ -291,22 +291,31 @@ function init(client, $, plugins) {
$('#bc_rouding').text(record.roundingcorrection.toFixed(2));
$('#bc_insulintotal').text(record.insulin.toFixed(2));
// Carbs needed if too much iob
if (record.insulin<0) {
// Carbs needed if too much iob or in range message when nothing entered and in range
var outcome = record.bg - record.insulin * isf;
if (record.othercorrection === 0 && record.carbs === 0 && record.cob === 0 && outcome > targetBGLow && outcome < targetBGHigh) {
$('#bc_carbsneeded').text('');
$('#bc_insulinover').text('');
$('#bc_carbsneededtr').css('display','none');
$('#bc_insulinneededtr').css('display','none');
$('#bc_calculationintarget').css('display','');
} else if (record.insulin<0) {
$('#bc_carbsneeded').text(record.carbsneeded+' g');
$('#bc_insulinover').text(record.insulin.toFixed(2));
$('#bc_carbsneededtr').css('display','');
$('#bc_insulinneededtr').css('display','none');
$('#bc_calculationintarget').css('display','none');
} else {
$('#bc_carbsneeded').text('');
$('#bc_insulinover').text('');
$('#bc_carbsneededtr').css('display','none');
$('#bc_insulinneededtr').css('display','');
$('#bc_calculationintarget').css('display','none');
}
// Show basal rate
var basal = client.sbx.data.profile.getTempBasal(record.eventTime);
$('#bc_basal').text((basal.treatment ? 'T ' : '') + basal.tempbasal.toFixed(3));
$('#bc_basal').text((basal.treatment ? 'T: ' : '') + basal.tempbasal.toFixed(3));
};
boluscalc.gatherBoluscalcData = function gatherBoluscalcData() {
@@ -437,7 +446,7 @@ function init(client, $, plugins) {
// Carbs needed if too much iob
record.carbsneeded = 0;
if (record.insulin<0) {
record.carbsneeded = Math.round(-total * ic);
record.carbsneeded = Math.ceil(-total * ic);
}
console.log('Insulin calculation result: ',record);
+3
View File
@@ -4788,6 +4788,9 @@ function init() {
cs: 'Použitý profil'
,ro: 'Profil folosit'
}
,'Calculation is in target range.' : {
cs: 'Kalkulace je v cílovém rozsahu.'
}
};
+7
View File
@@ -448,6 +448,13 @@
<span style="float:right" id="bc_rouding">0.00</span>
</td>
</tr>
<tr id="bc_calculationintarget" class="insulintotalcalculation border_bottom">
<td>
</td>
<td colspan="2">
<span class="translate" style="font-size:1em">Calculation is in target range.</span>
</td>
</tr>
<tr id="bc_insulinneededtr" class="insulintotalcalculation border_bottom">
<td>
<input title="Enter insulin correction in treatment" type="checkbox" id="bc_useinsulin" class="insulincalculationpart titletranslate" checked>