Skip to content

Commit

Permalink
Update VoucherSetService.php
Browse files Browse the repository at this point in the history
  • Loading branch information
ok200paul committed Sep 26, 2024
1 parent c98adad commit 63b4ce0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Services/VoucherSetService.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,13 @@ public static function calculateVoucherSetValueRemaining(VoucherSet $voucherSet)
*/
public static function collateVoucherSetAggregates(VoucherSet $voucherSet): void
{
$voucherSet->is_denomination_valid = self::validateVoucherSetDenominations($voucherSet);

$voucherSet->num_vouchers = Voucher::where('voucher_set_id', $voucherSet->id)->count();
$voucherSet->total_set_value = Voucher::where('voucher_set_id', $voucherSet->id)->sum('voucher_value_original');
$voucherSet->num_voucher_redemptions = VoucherRedemption::where('voucher_set_id', $voucherSet->id)->count();
$voucherSet->last_redemption_at = VoucherRedemption::where('voucher_set_id', $voucherSet->id)->max('created_at');
$voucherSet->total_set_value_remaining = self::calculateVoucherSetValueRemaining($voucherSet);
$voucherSet->is_denomination_valid = self::validateVoucherSetDenominations($voucherSet);

$voucherSet->saveQuietly();
}
Expand Down

0 comments on commit 63b4ce0

Please sign in to comment.