Skip to content

Commit

Permalink
Bei SysVar kommastellen zu precision umbenannt für Einheitlichkeit.
Browse files Browse the repository at this point in the history
Bei SysVar kommastellen zu precision umbenannt für Einheitlichkeit.
  • Loading branch information
christian1180 committed Feb 3, 2025
1 parent 1ec914b commit 1490f1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions components/SysVar.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

/*
2025-02-02 - Schappert:
Systemvariablen als Nummern unterstützen den Parameter "kommastellen":"x"
Systemvariablen als Nummern unterstützen den Parameter "precision":"x"
Damit wird die Zahl auf die Kommastellen reduziert bzw. aufgefüllt.
*/

Expand Down Expand Up @@ -54,16 +54,16 @@ function SysVar($component) {
// Number
$modalId = mt_rand();

if(isset($component['kommastellen']))
if(isset($component['precision']))
{
if(is_numeric($component['kommastellen']))
if(is_numeric($component['precision']))
{
$kommastellen = ' data-kommastellen="'.$component['kommastellen'].'" ';
$precision = ' data-precision="'.$component['precision'].'" ';
}
}
else
{
$kommastellen = "";
$precision = "";
}

// Indikator anzeigen?
Expand All @@ -79,7 +79,7 @@ function SysVar($component) {
.$ShowTime
. '<span class="info';
if ($component['indicator'] == '-1') $content = $content.' lheight';
$content = $content.'" data-id="' . $component['ise_id'] . '" data-component="' . $component['component'] . '" data-datapoint="4" data-unit="' . htmlentities($component['unit']) . '" data-indicator="' . $component['indicator'] . '" '.$kommastellen.'></span>'
$content = $content.'" data-id="' . $component['ise_id'] . '" data-component="' . $component['component'] . '" data-datapoint="4" data-unit="' . htmlentities($component['unit']) . '" data-indicator="' . $component['indicator'] . '" '.$precision.'></span>'
. '</div>';
if ($component['operate'] == 'true') $content = $content.'<div class="clearfix"></div></div><div class="hh2 collapse" id="' . $modalId . '">'
. '<div class="row text-center">'
Expand Down
6 changes: 3 additions & 3 deletions js/script.js.php
Original file line number Diff line number Diff line change
Expand Up @@ -1427,12 +1427,12 @@
}

}
var kommastellen = $('[data-id="' + ise_id + '"]').attr('data-kommastellen');
if (kommastellen)
var precision = $('[data-id="' + ise_id + '"]').attr('data-precision');
if (precision)
{
value = value.replace(",",".");
value = parseFloat(value)
value = value.toFixed(kommastellen) ;
value = value.toFixed(precision) ;
}
else
{
Expand Down

0 comments on commit 1490f1a

Please sign in to comment.