rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61)
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Architecture Guardrails (push) Successful in 2m38s
CI / Assistant Split Regression (push) Successful in 3m33s
CI / Typecheck (push) Successful in 3m51s
CI / Lint (push) Successful in 5m2s
CI / E2E Tests (push) Has been cancelled
CI / Fresh-Linux Docker Deploy (push) Has been cancelled
CI / Release Images (push) Has been cancelled
CI / Build (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
rename(phase 1): CapaKraken → Nexus across code, UI, docs, CI (#61) Co-authored-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com> Co-committed-by: Hartmut Nörenberg <hn@hartmut-noerenberg.com>
This commit was merged in pull request #61.
This commit is contained in:
@@ -3,7 +3,7 @@ import type {
|
||||
EstimateDemandLineCalculationMetadata,
|
||||
EstimateDemandLineRateMode,
|
||||
EstimateDemandSummary,
|
||||
} from "@capakraken/shared";
|
||||
} from "@nexus/shared";
|
||||
|
||||
export interface EstimateDemandLineRateSnapshot {
|
||||
resourceId?: string | null;
|
||||
@@ -36,9 +36,7 @@ function parseDemandLineMetadata(
|
||||
metadata: Record<string, unknown> | null | undefined,
|
||||
): ParsedDemandLineMetadata {
|
||||
const safeMetadata =
|
||||
typeof metadata === "object" && metadata !== null && !Array.isArray(metadata)
|
||||
? metadata
|
||||
: {};
|
||||
typeof metadata === "object" && metadata !== null && !Array.isArray(metadata) ? metadata : {};
|
||||
const rawCalculation =
|
||||
typeof safeMetadata.calculation === "object" &&
|
||||
safeMetadata.calculation !== null &&
|
||||
@@ -156,8 +154,7 @@ export function normalizeEstimateDemandLine<T extends EstimateDemandLineForCalcu
|
||||
? resourceSnapshot.ucrCents
|
||||
: line.billRateCents;
|
||||
const currency =
|
||||
((calculation.costRateMode === "resource" ||
|
||||
calculation.billRateMode === "resource") &&
|
||||
((calculation.costRateMode === "resource" || calculation.billRateMode === "resource") &&
|
||||
resourceSnapshot?.currency
|
||||
? resourceSnapshot.currency
|
||||
: line.currency) ||
|
||||
@@ -181,23 +178,13 @@ export function normalizeEstimateDemandLine<T extends EstimateDemandLineForCalcu
|
||||
}
|
||||
|
||||
export function summarizeEstimateDemandLines(
|
||||
demandLines: Pick<
|
||||
EstimateDemandLine,
|
||||
"hours" | "costTotalCents" | "priceTotalCents"
|
||||
>[],
|
||||
demandLines: Pick<EstimateDemandLine, "hours" | "costTotalCents" | "priceTotalCents">[],
|
||||
): EstimateDemandSummary {
|
||||
const totalHours = demandLines.reduce((sum, line) => sum + line.hours, 0);
|
||||
const totalCostCents = demandLines.reduce(
|
||||
(sum, line) => sum + line.costTotalCents,
|
||||
0,
|
||||
);
|
||||
const totalPriceCents = demandLines.reduce(
|
||||
(sum, line) => sum + line.priceTotalCents,
|
||||
0,
|
||||
);
|
||||
const totalCostCents = demandLines.reduce((sum, line) => sum + line.costTotalCents, 0);
|
||||
const totalPriceCents = demandLines.reduce((sum, line) => sum + line.priceTotalCents, 0);
|
||||
const marginCents = totalPriceCents - totalCostCents;
|
||||
const marginPercent =
|
||||
totalPriceCents > 0 ? Math.round((marginCents / totalPriceCents) * 100) : 0;
|
||||
const marginPercent = totalPriceCents > 0 ? Math.round((marginCents / totalPriceCents) * 100) : 0;
|
||||
|
||||
return {
|
||||
totalHours,
|
||||
|
||||
Reference in New Issue
Block a user