Skip to content

Commit

Permalink
Merge pull request #880 from jboolean/cut-color-costs
Browse files Browse the repository at this point in the history
Cut color costs
  • Loading branch information
jboolean authored Sep 4, 2023
2 parents a06d537 + ad00faa commit e0ddd86
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
10 changes: 7 additions & 3 deletions backend/src/business/ledger/LedgerService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import LedgerEntryType from '../../enum/LedgerEntryType';
const RATE_LIMIT_LOOKBACK = 24 * 60 * 60 * 1000; // 24 hours

// We allow this much usage in the lookback window
const MAX_LOOKBACK_USAGES = 2;
const MAX_LOOKBACK_USAGES = 1;

const SINGLE_PHOTO_USAGE_AMOUNT_POSITIVE = 1;

Expand Down Expand Up @@ -137,7 +137,8 @@ export async function grantCredits(
await ledgerRepository.save(entry);
}

const CENTS_PER_CREDIT = 10;
const CENTS_PER_CREDIT = 20;
const MAX_CREDITS_FOR_TIP = 15;

/**
* This exists because there is not a formal pay-for-credits flow in the app, but
Expand All @@ -159,7 +160,10 @@ export async function grantCreditsForTip(
// Credits are granted at a fixed rate
// Plus an amnesty for negative balances

const creditsFromPayment = Math.floor(amountCents / CENTS_PER_CREDIT);
const creditsFromPayment = Math.min(
Math.floor(amountCents / CENTS_PER_CREDIT),
MAX_CREDITS_FOR_TIP
);

await grantCredits(
userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ export default function CreditPurchaseModal(): JSX.Element {

<div>
<p>
Enjoy two free colorized photos per day using the best AI
colorization model available. After that, a small fee (equal to a
1948 subway ride) is required to cover the costs of the model.
Purchase tokens to keep exploring in color and support the site.
Enjoy one free colorized photo per day using the best AI
colorization model available. After that, a small fee is required to
cover the costs of the model. Purchase tokens to keep exploring in
color and support the site.
</p>

<p className={stylesheet.finePrint}>
Expand Down

0 comments on commit e0ddd86

Please sign in to comment.