avg and bugfix
This commit is contained in:
		| @@ -9,12 +9,16 @@ if(!empty($progress)) { | ||||
|   preg_match_all("/(?<task>.*): (?<act>.*) \/ (?<max>.*)/m", $progress, $tmp); | ||||
|  | ||||
|   for($i = 0; $i < count($tmp[0]); $i++) { | ||||
|     if(preg_match('/XP\:/', $tmp['task'][$i])) | ||||
|       continue; | ||||
|  | ||||
|     $list[$i] = (object)[ | ||||
|       'task' => trim($tmp['task'][$i]), | ||||
|       'act' => (int)str_replace('.', '', $tmp['act'][$i]), | ||||
|       'max' => (int)str_replace('.', '', $tmp['max'][$i]) | ||||
|     ]; | ||||
|     $list[$i]->percent = round($list[$i]->act / $list[$i]->max * 100, 2); | ||||
|     $list[$i]->left = $list[$i]->max - $list[$i]->act; | ||||
|   } | ||||
|  | ||||
|   usort($list, function($a, $b) { return $b->percent <=> $a->percent; }); | ||||
|   | ||||
| @@ -18,6 +18,7 @@ | ||||
|       <th>Aufgabe</th> | ||||
|       <th>Fortschritt</th> | ||||
|       <th>Ziel</th> | ||||
|       <th>übrig</th> | ||||
|       <th>Prozent</th> | ||||
|     </tr> | ||||
|   </thead> | ||||
| @@ -25,8 +26,9 @@ | ||||
|     {% for($i = 0; $i < count($list); $i++): %} | ||||
|     <tr style="background-color: {{ $i >= 5 ? 'red' : 'white' }}"> | ||||
|       <td>{{ $list[$i]->task }}</td> | ||||
|       <td>{{ $list[$i]->act }}</td> | ||||
|       <td>{{ $list[$i]->max }}</td> | ||||
|       <td>{{ number_format($list[$i]->act, 0, '', '.') }}</td> | ||||
|       <td>{{ number_format($list[$i]->max, 0, '', '.') }}</td> | ||||
|       <td>{{ number_format($list[$i]->left, 0, '', '.') }}</td> | ||||
|       <td>{{ $list[$i]->percent }}</td> | ||||
|     </tr> | ||||
|     {% endfor; %} | ||||
|   | ||||
		Reference in New Issue
	
	Block a user