({ userId, problemId }: { userId: string; problemId: string })
| 437 | } |
| 438 | |
| 439 | export async function getQuizScore({ userId, problemId }: { userId: string; problemId: string }) { |
| 440 | const value = await cache.get("getQuizScore", [userId.toString(), problemId.toString()]); |
| 441 | if (value) { |
| 442 | return value; |
| 443 | } |
| 444 | try { |
| 445 | const submissions = await db.quizScore.findMany({ |
| 446 | where: { |
| 447 | userId, |
| 448 | problemId, |
| 449 | }, |
| 450 | }); |
| 451 | await cache.set("getQuizScore", [userId.toString(), problemId.toString()], submissions); |
| 452 | return submissions; |
| 453 | } catch (e) { |
| 454 | return []; |
| 455 | } |
| 456 | } |
| 457 | |
| 458 | export async function getCategories() { |
| 459 | try { |
no test coverage detected