Skip to content

Commit f629624

Browse files
authored
Merge pull request #89 from hackclub/staging
Add reviewer payouts
2 parents cecfd79 + bea44c4 commit f629624

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

src/lib/defs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ export const BASE_SHOP_SCORE_PER_HOUR = 25.0;
1414
export const PRINT_PAYOUT_CENTS_PER_GRAM = 2.0;
1515
export const PRINT_MINUTES_PER_GRAM = 0.24;
1616

17+
export const T1_PAYOUT_BRICKS = 0.4;
18+
1719
export const BETA_DATE_CUTOFF = new Date('2025-12-16');
1820
export const BETA_MULTIPLIER = 1.5;

src/routes/+page.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@
356356
{:else}
357357
<Button text="Login with Hack Club" href="/auth/idv" />
358358
{/if}
359-
<p class="text-md my-3">Ages 13-18, launching December 15th!</p>
359+
<p class="text-md my-3">Ages 13-18, ending February 15th!</p>
360360
</div>
361361
</div>
362362
</div>

src/routes/dashboard/admin/review/[id]/+page.server.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { eq, and, asc, sql } from 'drizzle-orm';
55
import type { Actions } from './$types';
66
import { sendSlackDM } from '$lib/server/slack.js';
77
import { getReviewHistory } from '../../getReviewHistory.server';
8+
import { T1_PAYOUT_BRICKS } from '$lib/defs';
89

910
export async function load({ locals, params }) {
1011
if (!locals.user) {
@@ -98,7 +99,8 @@ export const actions = {
9899
.select({
99100
id: project.id,
100101
name: project.name,
101-
userId: project.userId
102+
userId: project.userId,
103+
status: project.status
102104
})
103105
.from(project)
104106
.where(and(eq(project.deleted, false), eq(project.id, id)));
@@ -124,6 +126,16 @@ export const actions = {
124126
feedback
125127
});
126128

129+
if (queriedProject.status === 'submitted' && action !== 'add_comment') {
130+
// Bricks payout for reviewer
131+
await db
132+
.update(user)
133+
.set({
134+
brick: locals.user.brick + T1_PAYOUT_BRICKS
135+
})
136+
.where(eq(user.id, locals.user.id));
137+
}
138+
127139
let status: typeof project.status._.data | undefined = undefined;
128140
let statusMessage = '';
129141

0 commit comments

Comments
 (0)