feat: sort table by time
This commit is contained in:
1 parent
c5e351cec3
commit
966554e615
1 file changed
+17
-14
+17
-14
@@ -120,20 +120,23 @@ export default async function EvaluationPage({ searchParams }: PageProps) {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{Object.entries(times).map(([category, minutes]) => (
|
||||
<tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}>
|
||||
<td style={{ padding: '0.5rem' }}>{category}</td>
|
||||
<td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}>
|
||||
{Math.floor(minutes / 60)}:{Math.round(minutes % 60)}h (={Math.round(minutes)} min)
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}%
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{total > 0 ? Math.round((minutes / (daysToFetch * 24 * 60)) * 1000) / 10 : 0}%
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
{Object.entries(times)
|
||||
.sort(([, minutesA], [, minutesB]) => minutesB - minutesA)
|
||||
.map(([category, minutes]) => (
|
||||
<tr key={category} style={{ borderBottom: '1px solid #e5e7eb' }}>
|
||||
<td style={{ padding: '0.5rem' }}>{category}</td>
|
||||
<td style={{ padding: '0.5rem', whiteSpace: 'nowrap' }}>
|
||||
{Math.floor(minutes / 60)}:{Math.round(minutes % 60).toString().padStart(2, '0')}h (={Math.round(minutes)} min)
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{total > 0 ? Math.round((minutes / total) * 1000) / 10 : 0}%
|
||||
</td>
|
||||
<td style={{ padding: '0.5rem' }}>
|
||||
{total > 0 ? Math.round((minutes / (daysToFetch * 24 * 60)) * 1000) / 10 : 0}%
|
||||
</td>
|
||||
</tr>
|
||||
))
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr style={{ fontWeight: 'bold' }}>
|
||||
|
||||
Reference in new issue
Block a user