Compare commits

...

5 Commits

Author SHA1 Message Date
agp8x fadffc6346 improved handling of missing values 2015-09-25 00:20:07 +02:00
agp8x f5e186ceae fixed mixed days in month-view 2015-09-02 11:57:52 +02:00
agp8x bb0bfa4818 month-view: fixed missing last day 2015-09-02 11:45:14 +02:00
agp8x 718552a90e fixed version-dump 2015-09-02 11:14:52 +02:00
agp8x 57336de413 added version-dump-pre-commit 2015-09-02 11:13:36 +02:00
5 changed files with 19 additions and 11 deletions

1
PREV_VERSION Normal file
View File

@ -0,0 +1 @@
bb0bfa4

View File

@ -44,7 +44,7 @@ function generateChart($today,$mode,$hours=0,$dateInput){
}elseif($mode==3){ }elseif($mode==3){
$selectionStart=mktime(0,0,0,$dateInput[1],1,$dateInput[0]); $selectionStart=mktime(0,0,0,$dateInput[1],1,$dateInput[0]);
$days=date("t",$selectionStart); $days=date("t",$selectionStart);
$selectionEnd=$selectionStart+($days*24*60*60); $selectionEnd=$selectionStart+(($days)*24*60*60);
$chartname="month_".$type."_".$month.".".$year; $chartname="month_".$type."_".$month.".".$year;
$chartdistance=60*24; $chartdistance=60*24;
}else{ }else{
@ -57,16 +57,13 @@ function generateChart($today,$mode,$hours=0,$dateInput){
$datas[]=$db->selectRange($type.$i,'*',$rangeSelector); $datas[]=$db->selectRange($type.$i,'*',$rangeSelector);
if($datas[$i-1]===false){ if($datas[$i-1]===false){
$html.='No values ('.$type.$i.')'; $html.='No values ('.$type.$i.')';
/* TODO: think about*/ $datas[$i-1]=array(0,0);
if($type!="ambi"){
return;
}
} }
} }
}else{ }else{
$where=array('year'=>$year,'month'=>$month); $where=array('year'=>$year,'month'=>$month);
$db->toggleDevmode(); //$db->toggleDevmode();
$summary=$db->select('summary','*',$where); $summary=$db->select('summary','*',$where,"ORDER BY day");
if($summary===false){ if($summary===false){
$html.="No values (".$type.")"; $html.="No values (".$type.")";
return; return;
@ -87,7 +84,9 @@ function generateChart($today,$mode,$hours=0,$dateInput){
$data_tmp=array(); $data_tmp=array();
$data_tmp1=array(); $data_tmp1=array();
$data_tmp2=array(); $data_tmp2=array();
#var_dump(sizeof($summary));
foreach($summary as $daysum){ foreach($summary as $daysum){
#var_dump($daysum);
$mintmp= (str_replace($unit,'',$daysum[$name.'-min'])); $mintmp= (str_replace($unit,'',$daysum[$name.'-min']));
if($min[0]>$mintmp){ if($min[0]>$mintmp){
$min[0]=$mintmp; $min[0]=$mintmp;
@ -274,13 +273,15 @@ function generateChart($today,$mode,$hours=0,$dateInput){
$labels=getLabels($datas[0],$selectionStart,$selectionEnd,$chartdistance); $labels=getLabels($datas[0],$selectionStart,$selectionEnd,$chartdistance);
if($mode==3){ if($mode==3){
$selectionStart+=60*60*24; $selectionStart+=60*60*24;
$div=1; $selectionEnd+=60*60*24;
$div=0;
} }
foreach($datas as $key=>$dataset){ foreach($datas as $key=>$dataset){
#file_put_contents('data'.$type.($key+1),var_export($dataset,true));
$values=prepareData($dataset,$div,$selectionStart,$selectionEnd,$chartdistance); $values=prepareData($dataset,$div,$selectionStart,$selectionEnd,$chartdistance);
//TODO: replace $type.($key+1) with actual name //TODO: replace $type.($key+1) with actual name
$myData->addPoints($values,$type.($key+1)); $myData->addPoints($values,$type.($key+1));
#file_put_contents('val1',var_export($values,true)); #file_put_contents('val'.$type.($key+1),var_export($values,true));
} }
$myData->addPoints($labels,"Labels"); $myData->addPoints($labels,"Labels");

2
dump-version.sh Executable file
View File

@ -0,0 +1,2 @@
#pre-commit
git log -n 1 --format=format:"%h" HEAD > PREV_VERSION

View File

@ -251,7 +251,11 @@ function prepareData($data,$div,$start=0,$end=0,$chartdistance=60){
$values=array(); $values=array();
$rawdata=outlinedLogPoints($data,$chartdistance,$start,$end); $rawdata=outlinedLogPoints($data,$chartdistance,$start,$end);
foreach($rawdata as $set){ foreach($rawdata as $set){
$values[]=round($set[0]/$div,1); if($div==0){
$values[]=$set[0];
}else{
$values[]=round($set[0]/$div,1);
}
} }
return $values; return $values;
} }

2
recent
View File

@ -1 +1 @@
Temperatur: 13.43 C<br>Luftfeuchtigkeit: 89.5 %<br>Helligkeit: 0.01 Lux<br>Luftdruck: 982.473mbar Temperatur: 22.81 C<br>Luftfeuchtigkeit: 0 %<br>Helligkeit: 0.01 Lux<br>Luftdruck: 0mbar