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

Function getProblem

apps/web/components/utils.tsx:19–38  ·  view source on GitHub ↗
(problemId: string | null)

Source from the content-addressed store, hash-verified

17}
18
19export async function getProblem(problemId: string | null) {
20 if (!problemId) {
21 return null;
22 }
23 const value: Problem = await cache.get("problems", [problemId.toString()]);
24 if (value) {
25 return value;
26 }
27 try {
28 const problem = await db.problem.findUnique({
29 where: {
30 id: problemId,
31 },
32 });
33 await cache.set("problems", [problemId.toString()], problem);
34 return problem;
35 } catch (err) {
36 return null;
37 }
38}
39
40export async function getFirstProblemForTrack(trackId: string) {
41 const value = await cache.get("tracks", [trackId.toString()]);

Callers 2

TrackComponentFunction · 0.90
TrackComponentFunction · 0.90

Calls 2

getMethod · 0.65
setMethod · 0.65

Tested by

no test coverage detected