Add reduced load on furnishing
parent
4e15c412a9
commit
8f887f1b90
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -794,6 +794,7 @@
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
"energy": "Energy",
|
"energy": "Energy",
|
||||||
"load": "Load",
|
"load": "Load",
|
||||||
|
"reduced": "Reduced",
|
||||||
"ratio": "Ratio",
|
"ratio": "Ratio",
|
||||||
"using": "Amount",
|
"using": "Amount",
|
||||||
"interior": "Interior",
|
"interior": "Interior",
|
||||||
|
|
|
@ -64,7 +64,10 @@
|
||||||
};
|
};
|
||||||
$: currentLoad = Object.entries(currentUsage[type]).reduce(
|
$: currentLoad = Object.entries(currentUsage[type]).reduce(
|
||||||
(prev, [id, val]) => {
|
(prev, [id, val]) => {
|
||||||
prev.load += data[id].load * val;
|
let reduced = Math.max(val - 1, 0);
|
||||||
|
let first = Math.min(1, val);
|
||||||
|
prev.load += data[id].load * first;
|
||||||
|
prev.load += data[id].reduced * reduced;
|
||||||
prev.energy += data[id].energy * val;
|
prev.energy += data[id].energy * val;
|
||||||
return prev;
|
return prev;
|
||||||
},
|
},
|
||||||
|
@ -92,6 +95,9 @@
|
||||||
case 'load':
|
case 'load':
|
||||||
if (sortOrder) return a.load - b.load;
|
if (sortOrder) return a.load - b.load;
|
||||||
else return b.load - a.load;
|
else return b.load - a.load;
|
||||||
|
case 'reduced':
|
||||||
|
if (sortOrder) return a.reduced - b.reduced;
|
||||||
|
else return b.reduced - a.reduced;
|
||||||
case 'using':
|
case 'using':
|
||||||
if (sortOrder) return (currentUsage[type][a.id] || 0) - (currentUsage[type][b.id] || 0);
|
if (sortOrder) return (currentUsage[type][a.id] || 0) - (currentUsage[type][b.id] || 0);
|
||||||
else return (currentUsage[type][b.id] || 0) - (currentUsage[type][a.id] || 0);
|
else return (currentUsage[type][b.id] || 0) - (currentUsage[type][a.id] || 0);
|
||||||
|
@ -285,6 +291,15 @@
|
||||||
>
|
>
|
||||||
{$t('furnishing.load')}
|
{$t('furnishing.load')}
|
||||||
</TableHeader>
|
</TableHeader>
|
||||||
|
<TableHeader
|
||||||
|
className="sticky top-0 bg-item z-30"
|
||||||
|
on:click={() => sort('reduced')}
|
||||||
|
sort={sortBy === 'reduced'}
|
||||||
|
order={sortOrder}
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
|
{$t('furnishing.reduced')}
|
||||||
|
</TableHeader>
|
||||||
<TableHeader
|
<TableHeader
|
||||||
className="sticky top-0 bg-item z-30"
|
className="sticky top-0 bg-item z-30"
|
||||||
on:click={() => sort('ratio')}
|
on:click={() => sort('ratio')}
|
||||||
|
@ -315,9 +330,10 @@
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
/>
|
/>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-4 text-gray-200">{item.name}</td>
|
<td class="px-4 text-gray-200 name-row">{item.name}</td>
|
||||||
<td class="px-4 text-gray-200 text-center">{item.energy}</td>
|
<td class="px-4 text-gray-200 text-center">{item.energy}</td>
|
||||||
<td class="px-4 text-gray-200 text-center">{item.load}</td>
|
<td class="px-4 text-gray-200 text-center">{item.load}</td>
|
||||||
|
<td class="px-4 text-gray-200 text-center">{item.reduced}</td>
|
||||||
<td class="px-4 text-gray-200 text-center" style={calculateColor(item.ratio)}>{item.ratio.toFixed(2)}</td>
|
<td class="px-4 text-gray-200 text-center" style={calculateColor(item.ratio)}>{item.ratio.toFixed(2)}</td>
|
||||||
<td class="px-4">
|
<td class="px-4">
|
||||||
<div
|
<div
|
||||||
|
@ -376,4 +392,9 @@
|
||||||
@apply block absolute top-0 left-0 w-full h-full bg-item;
|
@apply block absolute top-0 left-0 w-full h-full bg-item;
|
||||||
content: '';
|
content: '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.name-row {
|
||||||
|
max-width: 400px;
|
||||||
|
white-space: break-spaces;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue