Changeset 47 for trunk/Application/Model/stat_functions.php
- Timestamp:
- Jul 27, 2014, 9:14:56 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 2 1 config.php 2 .project
-
- Property svn:ignore
-
trunk/Application/Model/stat_functions.php
r43 r47 43 43 if($Unit == '') return(TruncateDigits($Value, $Digits)); 44 44 $I = 8; 45 if($Value > 0) $II = 1; 45 if($Value > 0) $II = 1; 46 46 else if($Value < 0) $II = -1; 47 47 else $II = 0; … … 99 99 $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time DESC LIMIT 2'); 100 100 //echo($Database->LastQuery."\n"); 101 if($Result->num_rows == 0) 102 { 103 $Database->insert($Measure['DataTable'], array('min' => $Value['min'], 'avg' => $Value['avg'], 'max' => $Value['max'], 'level' => $Level, 'measure' => $Measure['Id'], 'time' => TimeToMysqlDateTime($Time), 'continuity' => 0)); 101 if($Result->num_rows == 0) 102 { 103 $Database->insert($Measure['DataTable'], array('min' => $Value['min'], 'avg' => $Value['avg'], 'max' => $Value['max'], 'level' => $Level, 'measure' => $Measure['Id'], 'time' => TimeToMysqlDateTime($Time), 'continuity' => 0)); 104 104 //echo($Database->LastQuery."\n"); 105 105 } else if($Result->num_rows == 1) … … 237 237 } 238 238 } 239 else if($ValueType == 'min') 240 { 241 //echo($Values[$I+1]['continuity'].'=='.$Measure['ContinuityEnabled'].'<br>'); 239 else if($ValueType == 'min') 240 { 241 //echo($Values[$I+1]['continuity'].'=='.$Measure['ContinuityEnabled'].'<br>'); 242 242 if($Values[$I + 1]['continuity'] == $Measure['ContinuityEnabled']) 243 243 { … … 258 258 $NewValue[$ValueType] = $NewValue[$ValueType]; 259 259 } 260 //if(($RightTime - $LeftTime) > 0) 261 if($Measure['Cumulative'] == 0) 260 //if(($RightTime - $LeftTime) > 0) 261 if($Measure['Cumulative'] == 0) 262 262 { 263 263 $NewValue['avg'] = $NewValue['avg'] / ($RightTime - $LeftTime); … … 273 273 274 274 // Get first and last time 275 //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 275 //echo($Measure['Id'].','.$Level.','.StatTableName($Level)."\n"); 276 276 $Result = $Database->select($Measure['DataTable'], '*', 'measure='.$Measure['Id'].' AND level='.$Level.' ORDER BY time LIMIT 1'); 277 277 if($Result->num_rows > 0) … … 288 288 } else $AbsoluteRightTime = 0; 289 289 290 if($Debug) 290 if($Debug) 291 291 { 292 292 echo('AbsoluteLeftTime: '.$AbsoluteLeftTime.'('.TimeToMysqlDateTime($AbsoluteLeftTime).')<br>'); … … 297 297 298 298 function LoadRightSideValue($Level, $Measure, $Time) 299 { 299 { 300 300 global $Debug, $Database; 301 301 $Result = array(); … … 362 362 //$AbsoluteTime = GetTimeRange($MeasureId); 363 363 364 // if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 364 // if(($TimeFrom > $AbsoluteLeftTime) and ($TimeStart < $AbsoluteRightTime) and 365 365 // ($TimeTo > $AbsoluteLeftTime) and ($TimeTo < $AbsoluteRightTime)) 366 366 // { … … 480 480 // Load values in time range 481 481 //array_pop($NextValues); 482 } 482 } 483 483 echo("Uroven dokoncena<br>\n"); 484 484 $DbResult = $Database->select($Measure['DataTable'], 'COUNT(*)', 'level='.$Level.' AND measure='.$Measure['Id']); … … 525 525 ) ENGINE = MYISAM ;'); 526 526 } 527 528 ?>
Note:
See TracChangeset
for help on using the changeset viewer.