Changeset 96 for trunk/Modules/Measure/Measure.php
- Timestamp:
- Jan 5, 2026, 6:38:18 PM (41 hours ago)
- File:
-
- 1 edited
-
trunk/Modules/Measure/Measure.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Measure/Measure.php
r95 r96 64 64 function __construct(Database $Database) 65 65 { 66 $this->Id = 0;67 66 $this->ValueTypes = array('Min', 'Avg', 'Max'); 68 67 $this->Database = &$Database; … … 103 102 } 104 103 105 function AddValue( float $Value, int $Time): void104 function AddValue(int $Time, float $Min, float $Avg, float $Max): void 106 105 { 107 106 $Result = $this->Database->select($this->Data['DataTable'], '*', '(`Measure`='.$this->Data['Id'].') AND '. … … 110 109 // No measure value found. Simply insert new first value. 111 110 $this->Database->insert($this->Data['DataTable'], 112 array('Min' => $ Value, 'Avg' => $Value, 'Max' => $Value, 'Level' => 0,111 array('Min' => $Min, 'Avg' => $Avg, 'Max' => $Max, 'Level' => 0, 113 112 'Measure' => $this->Data['Id'], 'Time' => TimeToMysqlDateTime($Time), 114 113 'Continuity' => 0)); … … 116 115 // One value exists. Add second value. 117 116 $this->Database->insert($this->Data['DataTable'], 118 array('Min' => $ Value, 'Avg' => $Value, 'Max' => $Value, 'Level' => 0,117 array('Min' => $Min, 'Avg' => $Avg, 'Max' => $Max, 'Level' => 0, 119 118 'Measure' => $this->Data['Id'], 'Time' => TimeToMysqlDateTime($Time), 120 119 'Continuity' => 1)); … … 138 137 $Continuity = 0; 139 138 } 140 if (($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Value) and 139 if (($LastValue['Min'] == $NextToLastValue['Min']) and ($LastValue['Min'] == $Min) and 140 ($LastValue['Avg'] == $NextToLastValue['Avg']) and ($LastValue['Avg'] == $Avg) and 141 ($LastValue['Max'] == $NextToLastValue['Max']) and ($LastValue['Max'] == $Max) and 141 142 ($LastValue['Continuity'] == 1) and ($Continuity == 1)) 142 143 { … … 148 149 { 149 150 // Last value is different or not with continuity flag. Need to add new value. 150 $this->Database->insert($this->Data['DataTable'], array('Min' => $ Value,151 'Avg' => $ Value, 'max' => $Value, 'Level' => 0, 'Measure' => $this->Data['Id'],151 $this->Database->insert($this->Data['DataTable'], array('Min' => $Min, 152 'Avg' => $Avg, 'Max' => $Max, 'Level' => 0, 'Measure' => $this->Data['Id'], 152 153 'Time' => TimeToMysqlDateTime($Time), 153 154 'Continuity' => $Continuity)); … … 561 562 $this->Database->query('DROP TABLE `'.$Measure->GetDataTable().'`'); 562 563 } 563 564 564 }
Note:
See TracChangeset
for help on using the changeset viewer.
