MCPcopy Create free account
hub / github.com/code100x/daily-code / getFirstProblemForTrack

Function getFirstProblemForTrack

apps/web/components/utils.tsx:40–60  ·  view source on GitHub ↗
(trackId: string)

Source from the content-addressed store, hash-verified

38}
39
40export async function getFirstProblemForTrack(trackId: string) {
41 const value = await cache.get("tracks", [trackId.toString()]);
42 if (value) {
43 return value?.problems[0]?.problemId || null;
44 }
45
46 try {
47 const track = await db.track.findUnique({
48 where: {
49 id: trackId,
50 },
51 select: {
52 problems: true,
53 },
54 });
55 await cache.set("tracks", [trackId.toString()], track);
56 return track?.problems[0]?.problemId || null;
57 } catch (err) {
58 return null;
59 }
60}
61
62export async function getAllProblems() {
63 const value = await cache.get("getAllProblems", []);

Callers 1

RedirectToLastSolvedFunction · 0.90

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected