feat(MED-97): small fixes

This commit is contained in:
2025-09-26 15:37:47 +03:00
parent 0aa16c457a
commit 428cbd9477
7 changed files with 15 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
import { getSupabaseServerClient } from "@/packages/supabase/src/clients/server-client";
import { loadAccountBenefitStatistics, loadCompanyPersonalAccountsBalanceEntries } from "./load-team-account-benefit-statistics";
import { loadCompanyPersonalAccountsBalanceEntries } from "./load-team-account-benefit-statistics";
export interface TeamAccountBenefitExpensesOverview {
benefitAmount: number | null;
@@ -65,7 +65,7 @@ export async function loadTeamAccountBenefitExpensesOverview({
return benefitAmount * employeeCount * monthsLeft;
} else if (benefitOccurrence === 'quarterly') {
const quartersLeft = isCreatedThisYear
? QUARTERS - (createdAt.getMonth() / 3)
? QUARTERS - Math.ceil(createdAt.getMonth() / 3)
: QUARTERS;
return benefitAmount * employeeCount * quartersLeft;
}

View File

@@ -73,8 +73,7 @@ export const loadAccountBenefitStatistics = async (
.select('*')
.eq('company_id', accountId)
.eq('is_active', true)
.single()
.throwOnError();
.single();
const scheduleAmount = benefitDistributionSchedule?.benefit_amount || 0;
return {