Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions _patch_api5.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import pathlib

p = pathlib.Path('src/services/ApiService.ts')
s = p.read_text(encoding='utf-8')
p = pathlib.Path("src/services/ApiService.ts")
s = p.read_text(encoding="utf-8")

anchor = " getWaHelpQueue: () =>"
if anchor not in s:
# PR5 worktree predates PR4 — anchor on the weekly board instead
anchor = " getWeeklyBoard: () =>"
idx = s.index(anchor)
end = s.index('\n },', idx)
addition = '''
end = s.index("\n },", idx)
addition = """
// ---- Wave F items 66-69: reputation, awards, AMAs, requests ----
getMyReputation: () =>
apiFetch<ReputationProfile>('/community/reputation/me/'),
Expand Down Expand Up @@ -59,14 +59,14 @@
apiFetch<{ votes: number; voted: boolean }>(
`/community/problem-requests/${requestId}/vote/`,
{ method: 'POST' },
),'''
),"""
s = s[:end] + addition + s[end:]

# imports
old = " WaHelpRow,\n WikiListRow,"
if old in s:
new = " AmaDetailRow,\n AmaListRow,\n AwardRow,\n ProblemRequestRow,\n ReputationProfile,\n WaHelpRow,\n WikiListRow,"
# placeholder — replaced below
# placeholder — replaced below
else:
new = None

Expand All @@ -76,5 +76,5 @@
new = " AmaDetailRow,\n AmaListRow,\n AwardRow,\n CalibrationProfile,\n ProblemRequestRow,\n ReputationProfile,\n TeamStandingsResponse,"
assert old in s, f"import anchor missing: {old!r}"
s = s.replace(old, new, 1)
p.write_text(s, encoding='utf-8', newline='\n')
print('api ok')
p.write_text(s, encoding="utf-8", newline="\n")
print("api ok")
9 changes: 8 additions & 1 deletion backend/classroom/test_wave_e_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ def setUp(self):
self.assignment = Assignment.objects.create(
classroom=self.classroom,
title_i18n={"en": "HW1", "ro": "T1"},
available_from=timezone.now() - timedelta(days=2),
# 3 days, not 2: the grinder test pins submissions to fixed
# clock times up to ~72h old (10:00 two days ago), so a 2-day
# window set 'now-to-the-second' excludes them depending on the
# run time of day (CI 10:12 -> active_days 3; local 14:05 ->
# attempts 1). Widening the window start keeps every fixture
# submission inside at any hour; the out-of-window test still
# pins 30 days, far outside either way.
available_from=timezone.now() - timedelta(days=3),
due_at=timezone.now() + timedelta(days=2),
)
self.ap = AssignmentProblem.objects.create(
Expand Down
19 changes: 8 additions & 11 deletions src/services/ApiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -756,9 +756,7 @@ export const CommunityService = {
// ---- Wave F items 66-69: reputation, awards, AMAs, requests ----
getMyReputation: () => apiFetch<ReputationProfile>('/community/reputation/me/'),
getReputationTiers: () =>
apiFetch<{ tiers: { name: string; min_honor: number }[] }>(
'/community/reputation/tiers/',
),
apiFetch<{ tiers: { name: string; min_honor: number }[] }>('/community/reputation/tiers/'),
getAwards: (username?: string) => {
const qs = username ? `?username=${encodeURIComponent(username)}` : '';
return apiFetch<PaginatedResponse<AwardRow>>(`/community/awards/${qs}`);
Expand All @@ -771,10 +769,10 @@ export const CommunityService = {
body: JSON.stringify({ question }),
}),
answerAmaQuestion: (questionId: number, answer: string) =>
apiFetch<{ id: number; answer: string }>(
`/community/amas/questions/${questionId}/answer/`,
{ method: 'POST', body: JSON.stringify({ answer }) },
),
apiFetch<{ id: number; answer: string }>(`/community/amas/questions/${questionId}/answer/`, {
method: 'POST',
body: JSON.stringify({ answer }),
}),
upvoteAmaQuestion: (questionId: number) =>
apiFetch<{ upvotes: number; voted: boolean }>(
`/community/amas/questions/${questionId}/upvote/`,
Expand All @@ -788,10 +786,9 @@ export const CommunityService = {
body: JSON.stringify(data),
}),
voteProblemRequest: (requestId: number) =>
apiFetch<{ votes: number; voted: boolean }>(
`/community/problem-requests/${requestId}/vote/`,
{ method: 'POST' },
),
apiFetch<{ votes: number; voted: boolean }>(`/community/problem-requests/${requestId}/vote/`, {
method: 'POST',
}),

createWaHelpRequest: (submissionId: number, question: string) =>
apiFetch<WaHelpRow>('/community/wa-help/', {
Expand Down
Loading