Changeset 17531 for trunk/www/dch
- Timestamp:
- 01/21/14 01:37:16 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/dch/shifteval.php
r15314 r17531 33 33 $db_id = mysql_connect($host, $user, $pw); 34 34 35 $querynames="SELECT count(*), u FROM calendar. data ";35 $querynames="SELECT count(*), u FROM calendar.Data "; 36 36 $querynames.=" WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') "; 37 37 $querynames.=" AND NOT x=1 "; 38 38 $querynames.=" GROUP BY u ORDER BY u;"; 39 //$queryscales="select count(*), concat(y,if(m+1<10, concat('0',m), m+1),if (d<10, concat('0',d),d)) from calendar. data where u not in ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') group by y,m,d order by u;";39 //$queryscales="select count(*), concat(y,if(m+1<10, concat('0',m), m+1),if (d<10, concat('0',d),d)) from calendar.Data where u not in ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') group by y,m,d order by u;"; 40 40 $resultnames = mysql_query($querynames); 41 41 //$resultscales = mysql_query($queryscales); … … 43 43 { 44 44 $sum=0; 45 //$querynights="select fNight, fStartObservation, fStopObservation, Time_to_Sec(Timediff(fStopObservation, fStartObservatioN))/60./60., (Select count(*) from calendar. data where u not in ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') and y=Date_format(fNight, '%Y') and m=Date_format(fNight, '%m')-1 and d=Date_format(fNight,'%d') and u='".$rownames[1]."' group by y,m,d) from factdata.observationtimes;";45 //$querynights="select fNight, fStartObservation, fStopObservation, Time_to_Sec(Timediff(fStopObservation, fStartObservatioN))/60./60., (Select count(*) from calendar.Data where u not in ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') and y=Date_format(fNight, '%Y') and m=Date_format(fNight, '%m')-1 and d=Date_format(fNight,'%d') and u='".$rownames[1]."' group by y,m,d) from factdata.ObservationTimes;"; 46 46 $querynights="SELECT fNight, fStartObservation, fStopObservation, Time_to_Sec(Timediff(fStopObservation, fStartObservatioN))/60./60.+1, "; 47 $querynights.=" (SELECT COUNT(*) FROM calendar. data WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') AND NOT x=1 ";47 $querynights.=" (SELECT COUNT(*) FROM calendar.Data WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') AND NOT x=1 "; 48 48 $querynights.=" AND y=DATE_FORMAT(fNight, '%Y') AND m=DATE_FORMAT(fNight, '%m')-1 AND d=DATE_FORMAT(fNight,'%d') "; 49 $querynights.=" GROUP BY y,m,d), (SELECT COUNT(*) FROM calendar. data WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') AND NOT x=1 ";49 $querynights.=" GROUP BY y,m,d), (SELECT COUNT(*) FROM calendar.Data WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') AND NOT x=1 "; 50 50 $querynights.=" AND y=DATE_FORMAT(fNight, '%Y') AND m=DATE_FORMAT(fNight, '%m')-1 AND d=DATE_FORMAT(fNight,'%d') "; 51 $querynights.=" AND u='".$rownames[1]."' GROUP BY y,m,d) FROM factdata. observationtimes ";51 $querynights.=" AND u='".$rownames[1]."' GROUP BY y,m,d) FROM factdata.ObservationTimes "; 52 52 $querynights.=" WHERE fNight>=".$startdate." and fNight<=".$stopdate; 53 53 $resultnights = mysql_query($querynights); … … 70 70 echo "</table>\n<br>\n"; 71 71 72 echo "Debugging times: <br>\n";72 echo "Debugging times: (only after 2013/01, i.e. first 16 months missing) <br>\n"; 73 73 echo "<table>\n"; 74 74 75 $querynames="SELECT count(*), u FROM calendar. data ";75 $querynames="SELECT count(*), u FROM calendar.Data "; 76 76 $querynames.=" WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') "; 77 77 $querynames.=" AND NOT x=0 "; 78 78 $querynames.=" GROUP BY u ORDER BY u;"; 79 //$queryscales="select count(*), concat(y,if(m+1<10, concat('0',m), m+1),if (d<10, concat('0',d),d)) from calendar. data where u not in ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') group by y,m,d order by u;";79 //$queryscales="select count(*), concat(y,if(m+1<10, concat('0',m), m+1),if (d<10, concat('0',d),d)) from calendar.Data where u not in ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') group by y,m,d order by u;"; 80 80 $resultnames = mysql_query($querynames); 81 81 //$resultscales = mysql_query($queryscales); … … 84 84 $sum=0; 85 85 $querynights="SELECT fNight, fStartObservation, fStopObservation, Time_to_Sec(Timediff(fStopObservation, fStartObservation))/60./60.+1, "; 86 $querynights.=" (SELECT COUNT(*) FROM calendar. data WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') AND NOT x=0 ";86 $querynights.=" (SELECT COUNT(*) FROM calendar.Data WHERE u NOT IN ('ETHZ', 'ISDC', 'UNIDO', 'UNIWUE') AND NOT x=0 "; 87 87 $querynights.=" AND y=DATE_FORMAT(fNight, '%Y') AND m=DATE_FORMAT(fNight, '%m')-1 AND d=DATE_FORMAT(fNight,'%d') "; 88 $querynights.=" AND u='".$rownames[1]."' GROUP BY y,m,d) FROM factdata. observationtimes ";88 $querynights.=" AND u='".$rownames[1]."' GROUP BY y,m,d) FROM factdata.ObservationTimes "; 89 89 $querynights.=" WHERE fNight>=".$startdate." and fNight<=".$stopdate; 90 90 $resultnights = mysql_query($querynights); … … 99 99 } 100 100 echo "<tr>\n<td>".$rownames[1]."</td>\n<td>".$sum."</td>\n</tr>"; 101 mysql_free_result($resultnights);101 mysql_free_result($resultnights); 102 102 } 103 103 //$sumhours+=$hours*scale … … 106 106 //mysql_free_result($resultscales); 107 107 108 echo "</table>\n<br>\n<br>\n"; 109 110 $queryexpert ="SELECT fNight, Time_to_Sec(Timediff(fStopObservation, fStartObservation))/60./60.+1 FROM factdata.ObservationTimes "; 111 $queryexpert .=" WHERE fNight>=".$startdate." and fNight<=".$stopdate." GROUP BY fNight"; 112 $resultexpert = mysql_query($queryexpert); 113 $sumexpert=0; 114 $sumthomas=0; 115 $sumdani=0; 116 $sumjens=0; 117 $sumdom=0; 118 //echo mysql_num_rows($resultexpert)."<br>"; 119 120 //total 1 year: 4000 hours ~10.9h/night -> 46 hours/shift slot 121 //1 shift slot 46 hours 122 // 4000/46 = 87 123 // -> 87 shift slots 124 // expert 6 slots 125 // 87/6 -> 14.5 126 // => expert counts 1/13 of normal time 127 $devide=14.5; 128 while ($rowexpert = mysql_fetch_row($resultexpert)) 129 { 130 if ($rowexpert[0]>20130801) 131 { 132 $sumthomas+=$rowexpert[1]/$devide/3; 133 $sumdani+=$rowexpert[1]/$devide/3; 134 $sumjens+=$rowexpert[1]/$devide/3; 135 } 136 else 137 { 138 if ($rowexpert[0]>20130101) 139 { 140 $sumthomas+=$rowexpert[1]/$devide/2; 141 $sumdani+=$rowexpert[1]/$devide/2; 142 } 143 else 144 { 145 $sumthomas+=$rowexpert[1]/$devide/3; 146 $sumdani+=$rowexpert[1]/$devide/3; 147 $sumdom+=$rowexpert[1]/$devide/3; 148 } 149 } 150 $sumexpert+=$rowexpert[1]/$devide; 151 } 152 153 //echo $sumexpert; 154 echo "Expert-on-Call times: <br>\n"; 155 echo "<table>\n"; 156 if ($sumthomas) 157 echo "<tr>\n<td>tbretz</td>\n<td>".$sumthomas."</td>\n</tr>"; 158 if ($sumdani) 159 echo "<tr>\n<td>dorner</td>\n<td>".$sumdani."</td>\n</tr>"; 160 if ($sumjens) 161 echo "<tr>\n<td>jbuss</td>\n<td>".$sumjens."</td>\n</tr>"; 162 if ($sumdom) 163 echo "<tr>\n<td>dneise</td>\n<td>".$sumdom."</td>\n</tr>"; 164 echo "</table>\n"; 165 108 166 mysql_close($db_id); 109 echo "</table>\n";110 167 111 168 echo "</form>\n";
Note:
See TracChangeset
for help on using the changeset viewer.