Skip to content
Snippets Groups Projects
Commit 1da77325 authored by Jonas Zohren's avatar Jonas Zohren :speech_balloon:
Browse files

Pass s & u to sumrow

parent f8eb6f42
Branches
No related tags found
No related merge requests found
Pipeline #15561 passed
......@@ -36,7 +36,7 @@ import type { WorkPackage } from "./estimator";
{#each workPackages as workPackage, i (i)}
<RowWorkItem bind:a={workPackage.a} bind:b={workPackage.b} bind:c={workPackage.c} u={u} r={r}></RowWorkItem>
{/each}
<SumRow {workPackages}></SumRow>
<SumRow {workPackages} u={u} r={r}></SumRow>
</tbody>
</table>
<details>
......
<script lang="ts">
import type { WorkPackage } from "./estimator";
import { calculateSSum, calculateESum } from './estimator';
import { calculateSSum, calculateESum, calculateVSum } from './estimator';
import { roundOne, sumIgnoreNonNumbers } from "./utils";
export let workPackages: WorkPackage[]
......@@ -26,5 +26,6 @@
<td class="tg-0lax">
</td>
<td class="tg-0lax">
{roundOne(calculateVSum(workPackages, u))}
</td>
</tr>
\ No newline at end of file
......@@ -66,3 +66,11 @@ export function calculateESum(workPackages: WorkPackage[], r: number): number {
.map((workPackage) => calculateE(workPackage, r))
);
}
export function calculateVSum(workPackages: WorkPackage[], u: number): number {
return sumIgnoreNonNumbers(
workPackages
.filter(({ a, b }) => typeof a === "number" && typeof b === "number")
.map((workPackage) => calculateV(workPackage, u))
);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment