Skip to content

Commit

Permalink
Merge pull request #1537 from appwrite/fix-plan-summary-without-invoices
Browse files Browse the repository at this point in the history
Fix for when no invoices are available
  • Loading branch information
ArmanNik authored Nov 26, 2024
2 parents 4623e8e + 3ea5d1f commit b9bab13
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@
export let currentPlan: Plan;
export let creditList: CreditList;
const currentInvoice: Invoice = invoices[0];
const currentInvoice: Invoice | undefined = invoices.length > 0 ? invoices[0] : undefined;
const extraMembers = members.total > 1 ? members.total - 1 : 0;
const availableCredit = creditList.available;
const today = new Date();
const isTrial =
new Date($organization?.billingStartDate).getTime() - today.getTime() > 0 &&
$plansInfo.get($organization.billingPlan)?.trialDays;
const extraUsage = currentInvoice.amount - currentPlan?.price;
const extraAddons = currentInvoice.usage?.length;
const extraUsage = currentInvoice ? currentInvoice.amount - currentPlan?.price : 0;
const extraAddons = currentInvoice ? currentInvoice.usage?.length : 0;
</script>

{#if $organization}
Expand Down

0 comments on commit b9bab13

Please sign in to comment.