Skip to content

Add result monitoring for quiz sets #3010

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 38 commits into from

Conversation

Henry7482
Copy link
Collaborator

@Henry7482 Henry7482 commented Jun 4, 2025

This PR includes:

  • A static statistics page for each quizset, monitoring the number of quizzes, attempts, active students and average pass rate
  • A button to route the statistics page in each quiz set

Summary by CodeRabbit

  • New Features

    • Added a detailed quiz set statistics page, displaying metrics such as average pass rate, average score, total participants, active quizzes, and individual quiz performance.
    • Introduced a new action button in the quiz set details view to access the statistics page.
    • Enhanced localization with new English and Vietnamese strings for quiz statistics and home page hero sections.
  • Style

    • Improved code formatting and consistency in the quiz set details page.

Copy link
Contributor

coderabbitai bot commented Jun 4, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This update introduces new English and Vietnamese localization strings for quiz set statistics and home page hero features. It adds a new statistics page for quiz sets, displaying detailed metrics and individual quiz performance. The quiz set details layout now includes a button linking to this statistics page. Most other changes are stylistic.

Changes

File(s) Change Summary
apps/upskii/messages/en.json, apps/upskii/messages/vi.json Added new localization keys for "quiz-set-statistics", "home-hero", and "common.statistics" in English and Vietnamese.
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/layout.tsx Added a new action button linking to the quiz set statistics page.
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/page.tsx Refactored imports and formatting; no functional changes.
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx New file: Implements the quiz set statistics page with data fetching and UI for summary and per-quiz stats.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant QuizSetDetailsLayout
    participant StatisticsPage
    participant SupabaseDB

    User->>QuizSetDetailsLayout: Views quiz set details
    QuizSetDetailsLayout->>User: Shows "Statistics" button
    User->>QuizSetDetailsLayout: Clicks "Statistics" button
    QuizSetDetailsLayout->>StatisticsPage: Navigates to /statistics
    StatisticsPage->>SupabaseDB: Fetch quiz and attempt statistics
    SupabaseDB-->>StatisticsPage: Returns statistics data
    StatisticsPage->>User: Renders summary cards and per-quiz stats
Loading

Possibly related PRs

Suggested labels

upskii

Suggested reviewers

  • vhpx

Poem

A hop and a skip through code anew,
With stats and charts in every view!
New words for heroes, numbers for sets,
English and Vietnamese—no one forgets.
Click the button, see the score—
Upskii’s quizzes now show more!
🐇📊✨


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

graphite-app bot commented Jun 4, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (2)
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/layout.tsx (1)

72-79: Improve route construction consistency.

The action button implementation is well-structured, but the route construction could be more consistent with the existing pattern.

Consider using the existing commonHref variable for consistency:

        action={
          <Button variant="outline" className="gap-2" asChild>
-            <Link href={`/${wsId}/quiz-sets/${setId}/statistics`}>
+            <Link href={`${commonHref}/statistics`}>
              <BarChart3 className="h-4 w-4" />
              {t("common.statistics")}
            </Link>
          </Button>
        }

This approach aligns with how other links are constructed in the component and improves maintainability.

apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx (1)

255-255: Improve error handling specificity.

Instead of catching and logging all errors generically, consider handling specific error cases and potentially re-throwing critical errors.

-    console.error("Error fetching quiz statistics:", error)
+    console.error("Failed to fetch quiz statistics for set", setId, error)
+    // Consider re-throwing or handling specific error types
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1990284 and fc1939d.

📒 Files selected for processing (5)
  • apps/upskii/messages/en.json (2 hunks)
  • apps/upskii/messages/vi.json (2 hunks)
  • apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/layout.tsx (2 hunks)
  • apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/page.tsx (2 hunks)
  • apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/page.tsx (3)
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/page.tsx (1)
  • WorkspaceQuizzesPage (25-63)
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quizzes/page.tsx (1)
  • WorkspaceQuizzesPage (25-59)
packages/types/src/db.ts (1)
  • WorkspaceQuiz (16-16)
🔇 Additional comments (7)
apps/upskii/messages/en.json (2)

21-44: home-hero translations look solid
Localization keys and placeholders align with the new UI; placeholders ({username}) follow the established pattern.


322-322: Add "statistics" key under common
This key provides the label for the statistics button across the app. No conflicts with existing keys.

apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/layout.tsx (2)

10-13: LGTM! Clean import additions.

The new imports are properly structured and follow the existing import patterns in the file. All imported components are utilized in the code.


76-76:

✅ Verification successful

Verify the localization key exists.

Please ensure that the "common.statistics" localization key is properly defined in the translation files.


🏁 Script executed:

#!/bin/bash
# Description: Verify that the localization key "common.statistics" exists in translation files
# Expected: Find the key in both English and Vietnamese translation files

echo "Checking for 'statistics' key in common section of translation files..."
fd -e json messages | xargs grep -l "statistics" | head -5
echo ""
echo "Contents of translation files:"
fd -e json messages | xargs cat | jq '.common.statistics // empty' 2>/dev/null || echo "Key not found or invalid JSON"

Length of output: 368


🏁 Script executed:

#!/bin/bash
# Locate translation directories
echo "Looking for directories named 'locales', 'i18n', or 'messages'..."
fd -t d -g 'locales' | sed 's/^/  locales dir: /'
fd -t d -g 'i18n'    | sed 's/^/  i18n dir:    /'
fd -t d -g 'messages'| sed 's/^/  messages dir:/' 

echo ""
# Find all common.json files
echo "Searching for 'common.json' translation files..."
fd -t f -g 'common.json' | sed 's/^/  found: /'

echo ""
# Check for "statistics" key in each common.json
for file in $(fd -t f -g 'common.json'); do
  echo "Checking $file:"
  jq '.statistics // "Key not found"' "$file" || echo "  ✗ Could not parse $file"
done

Length of output: 953


🏁 Script executed:

#!/bin/bash
set -e

echo "Listing all translation files in apps/upskii/messages:"
fd -t f . apps/upskii/messages | sed 's/^/  /'

echo ""
echo "Searching for 'statistics' key in apps/upskii/messages:"
rg -n '"statistics"' apps/upskii/messages || echo "  → No 'statistics' key found in messages/"

echo ""
echo "Listing all translation files in apps/upskii/src/i18n:"
fd -t f . apps/upskii/src/i18n | sed 's/^/  /'

echo ""
echo "Searching for 'statistics' key in apps/upskii/src/i18n:"
rg -n '"statistics"' apps/upskii/src/i18n || echo "  → No 'statistics' key found in src/i18n/"

Length of output: 1190


🏁 Script executed:

#!/bin/bash
set -e

echo "Checking '.common.statistics' in apps/upskii/messages/en.json:"
jq '.common.statistics // "Key not found"' apps/upskii/messages/en.json

echo ""
echo "Checking '.common.statistics' in apps/upskii/messages/vi.json:"
jq '.common.statistics // "Key not found"' apps/upskii/messages/vi.json

Length of output: 473


Localization key “common.statistics” verified
The common.statistics key exists in both apps/upskii/messages/en.json and apps/upskii/messages/vi.json, so no further action is needed.

apps/upskii/messages/vi.json (2)

21-44: Add new "home-hero" localization block
The new "home-hero" section adds personalized welcome messages and feature card texts correctly.


322-322: Add "statistics" to common localization
The statistics key under common is correctly added for use in quiz set layouts.

apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/page.tsx (1)

1-95: Stylistic improvements look good.

The formatting changes improve consistency by standardizing quote usage and code style across the file.

Comment on lines +2 to +20
"quiz-set-statistics": {
"title": "Quiz Set Statistics",
"description": "View detailed statistics for your quizzes, including average scores, completion rates, and more.",
"average_pass_rate": "Average Pass Rate",
"average_score": "Average Score",
"total_participants": "Total Participants",
"total_quizzes": "Total Quizzes",
"active_quizzes": "Active quizzes in set",
"total_attempts": "Total Attempts",
"accross_all_quizzes": "Across all quizzes",
"individual_quiz_performance": "Individual Quiz Performance",
"back": "Back",
"pass_rate": "Pass Rate",
"active_students": "Active Students",
"unique_participants": "Unique participants",
"last_attempt": "Last Attempt",
"no_quizzes": "No Quiz Data Available",
"no_quizzes_description": "No quiz attempts found for this set. Students haven't started taking quizzes yet."
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typo & Label Casing in "quiz-set-statistics"

  • Rename "accross_all_quizzes" to "across_all_quizzes" to correct spelling.
  • Consider capitalizing the value for "active_quizzes" to "Active Quizzes in Set" for consistency with other labels.
🤖 Prompt for AI Agents
In apps/upskii/messages/en.json between lines 2 and 20, correct the typo in the
key "accross_all_quizzes" by renaming it to "across_all_quizzes". Also, update
the value of "active_quizzes" to "Active Quizzes in Set" to maintain consistent
capitalization with other labels in the "quiz-set-statistics" section.

Comment on lines +2 to +20
"quiz-set-statistics": {
"title": "Thống Kê",
"description": "Xem thống kê chi tiết về các bài kiểm tra của bạn, bao gồm điểm trung bình, tỷ lệ hoàn thành và nhiều thông tin khác.",
"average_pass_rate": "Tỷ Lệ Đạt Trung Bình",
"average_score": "Điểm Trung Bình",
"total_participants": "Tổng Số Người Tham Gia",
"total_quizzes": "Tổng Số Bài Kiểm Tra",
"active_quizzes": "Bài kiểm tra hiện có",
"total_attempts": "Tổng Số Lượt Làm Bài",
"accross_all_quizzes": "Trên tất cả bài kiểm tra",
"individual_quiz_performance": "Số Liệu Từng Bài Kiểm Tra",
"back": "Quay Lại",
"pass_rate": "Tỷ Lệ Đạt",
"active_students": "Học Viên Đang Hoạt Động",
"unique_participants": "Người tham gia khác nhau",
"last_attempt": "Lần Làm Bài Gần Nhất",
"no_quizzes": "Không Có Dữ Liệu Bài Kiểm Tra",
"no_quizzes_description": "Không tìm thấy lượt làm bài nào cho bộ câu hỏi này. Học viên chưa bắt đầu làm bài kiểm tra."
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typo in key "accross_all_quizzes"
The key "accross_all_quizzes" is misspelled and should be "across_all_quizzes" to align with proper spelling and the English file.
Apply this diff:

-    "accross_all_quizzes": "Trên tất cả bài kiểm tra",
+    "across_all_quizzes": "Trên tất cả bài kiểm tra",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"quiz-set-statistics": {
"title": "Thống Kê",
"description": "Xem thống kê chi tiết về các bài kiểm tra của bạn, bao gồm điểm trung bình, tỷ lệ hoàn thành và nhiều thông tin khác.",
"average_pass_rate": "Tỷ Lệ Đạt Trung Bình",
"average_score": "Điểm Trung Bình",
"total_participants": "Tổng Số Người Tham Gia",
"total_quizzes": "Tổng Số Bài Kiểm Tra",
"active_quizzes": "Bài kiểm tra hiện có",
"total_attempts": "Tổng Số Lượt Làm Bài",
"accross_all_quizzes": "Trên tất cả bài kiểm tra",
"individual_quiz_performance": "Số Liệu Từng Bài Kiểm Tra",
"back": "Quay Lại",
"pass_rate": "Tỷ Lệ Đạt",
"active_students": "Học Viên Đang Hoạt Động",
"unique_participants": "Người tham gia khác nhau",
"last_attempt": "Lần Làm Bài Gần Nhất",
"no_quizzes": "Không Có Dữ Liệu Bài Kiểm Tra",
"no_quizzes_description": "Không tìm thấy lượt làm bài nào cho bộ câu hỏi này. Học viên chưa bắt đầu làm bài kiểm tra."
},
"quiz-set-statistics": {
"title": "Thống Kê",
"description": "Xem thống kê chi tiết về các bài kiểm tra của bạn, bao gồm điểm trung bình, tỷ lệ hoàn thành và nhiều thông tin khác.",
"average_pass_rate": "Tỷ Lệ Đạt Trung Bình",
"average_score": "Điểm Trung Bình",
"total_participants": "Tổng Số Người Tham Gia",
"total_quizzes": "Tổng Số Bài Kiểm Tra",
"active_quizzes": "Bài kiểm tra hiện có",
"total_attempts": "Tổng Số Lượt Làm Bài",
"across_all_quizzes": "Trên tất cả bài kiểm tra",
"individual_quiz_performance": "Số Liệu Từng Bài Kiểm Tra",
"back": "Quay Lại",
"pass_rate": "Tỷ Lệ Đạt",
"active_students": "Học Viên Đang Hoạt Động",
"unique_participants": "Người tham gia khác nhau",
"last_attempt": "Lần Làm Bài Gần Nhất",
"no_quizzes": "Không Có Dữ Liệu Bài Kiểm Tra",
"no_quizzes_description": "Không tìm thấy lượt làm bài nào cho bộ câu hỏi này. Học viên chưa bắt đầu làm bài kiểm tra."
},
🤖 Prompt for AI Agents
In apps/upskii/messages/vi.json around lines 2 to 20, the key
"accross_all_quizzes" is misspelled. Rename the key to "across_all_quizzes" to
correct the spelling and maintain consistency with the English version.

Comment on lines 206 to 258
async function getQuizSetStatistics(setId: string): Promise<QuizStats[]> {
const supabase = await createClient()

try {
// Get all quizzes in this set
const { data: quizzes } = await supabase
.from("quiz_set_quizzes")
.select("...workspace_quizzes(id, question)")
.eq("set_id", setId)

if (!quizzes) return []

const quizStats: QuizStats[] = []

for (const quiz of quizzes) {
if (!quiz.id) continue

// Get quiz attempts and scores
const { data: attempts } = await supabase
.from("workspace_quiz_attempts")
.select("user_id, score, created_at")
.eq("quiz_id", quiz.id)

if (!attempts) continue

const totalAttempts = attempts.length
const uniqueStudents = new Set(attempts.map((a) => a.user_id)).size
const averageScore =
attempts.length > 0 ? attempts.reduce((sum, a) => sum + (a.score || 0), 0) / attempts.length : 0
const passRate =
attempts.length > 0 ? (attempts.filter((a) => (a.score || 0) >= 70).length / attempts.length) * 100 : 0
const lastAttempt =
attempts.length > 0
? attempts.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime())[0].created_at
: null

quizStats.push({
id: quiz.id,
question: quiz.question || "Untitled Quiz",
totalAttempts,
uniqueStudents,
averageScore: Math.round(averageScore * 100) / 100,
passRate: Math.round(passRate * 100) / 100,
lastAttempt,
})
}

return quizStats
} catch (error) {
console.error("Error fetching quiz statistics:", error)
return []
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Optimize database queries to avoid N+1 problem.

The current implementation makes one query per quiz to fetch attempts, which will cause performance issues as the number of quizzes grows. Consider fetching all attempts for all quizzes in the set with a single query.

Additionally:

  • The hardcoded pass threshold (70) should be configurable
  • The error handling should be more specific rather than catching all errors
  • "Untitled Quiz" should be localized

Example optimization approach:

// Fetch all attempts for all quizzes in one query
const { data: attempts } = await supabase
  .from("workspace_quiz_attempts")
  .select("quiz_id, user_id, score, created_at")
  .in("quiz_id", quizzes.map(q => q.id).filter(Boolean))

// Group attempts by quiz_id for processing
const attemptsByQuiz = attempts?.reduce((acc, attempt) => {
  if (!acc[attempt.quiz_id]) acc[attempt.quiz_id] = []
  acc[attempt.quiz_id].push(attempt)
  return acc
}, {} as Record<string, typeof attempts>) ?? {}
🤖 Prompt for AI Agents
In
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx
between lines 206 and 258, the current code queries quiz attempts inside a loop
causing an N+1 query problem. Refactor to first fetch all quiz attempts for all
quizzes in a single query using the quiz IDs, then group attempts by quiz_id for
processing. Replace the hardcoded pass threshold (70) with a configurable
parameter. Improve error handling by catching specific errors instead of a
generic catch-all. Also, replace the hardcoded "Untitled Quiz" string with a
localized version using the app's i18n or localization system.

Comment on lines 33 to 37
totalQuizzes: stats.length,
totalAttempts: stats.reduce((sum, s) => sum + s.totalAttempts, 0),
totalStudents: new Set(stats.flatMap((s) => Array(s.uniqueStudents).fill(0))).size,
averagePassRate: stats.length > 0 ? stats.reduce((sum, s) => sum + s.passRate, 0) / stats.length : 0,
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix incorrect unique students calculation.

The current logic for calculating total unique students is flawed. Creating arrays filled with zeros and using a Set will always result in a size of 1 (containing only the value 0), regardless of the actual number of unique students.

To properly calculate unique students across all quizzes, you need to aggregate the actual user IDs from the database rather than using the count values.

🤖 Prompt for AI Agents
In
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx
around lines 33 to 37, the calculation of totalStudents is incorrect because it
uses counts to create arrays of zeros and then a Set, which always results in 1.
To fix this, replace this logic by aggregating the actual unique student user
IDs from the stats data or database, then count the distinct user IDs to get the
correct total unique students value.

<div className="space-y-4">
<div className="flex items-center justify-between">
<h2 className="text-2xl font-semibold">{t("individual_quiz_performance")}</h2>
<p className="text-sm text-muted-foreground">{stats.length} quizzes analyzed</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Localize remaining hardcoded strings.

Several UI strings need to be moved to localization files:

  • Line 121: "quizzes analyzed"
  • Line 142: "Quiz #"
  • Line 144: "Quiz ID:"
  • Line 156: Status labels ("Excellent", "Good", "Needs Attention")
  • Line 191: "Never"

Also applies to: 142-144, 156-156, 191-191

🤖 Prompt for AI Agents
In
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx
at lines 121, 142-144, 156, and 191, the UI strings such as "quizzes analyzed",
"Quiz #", "Quiz ID:", status labels ("Excellent", "Good", "Needs Attention"),
and "Never" are hardcoded. Replace these hardcoded strings with calls to the
localization function or use localized string variables from your i18n setup to
ensure all user-facing text is properly localized.

</CardHeader>
<CardContent>
<div className="text-3xl font-bold">{overallStats.totalAttempts}</div>
<p className="text-xs text-muted-foreground">{t("accross_all_quizzes")}</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix typo in localization key.

There's a typo in the translation key.

-            <p className="text-xs text-muted-foreground">{t("accross_all_quizzes")}</p>
+            <p className="text-xs text-muted-foreground">{t("across_all_quizzes")}</p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<p className="text-xs text-muted-foreground">{t("accross_all_quizzes")}</p>
<p className="text-xs text-muted-foreground">{t("across_all_quizzes")}</p>
🤖 Prompt for AI Agents
In
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx
at line 84, the localization key "accross_all_quizzes" contains a typo. Correct
the key to "across_all_quizzes" to fix the spelling error in the translation
reference.

</CardHeader>
<CardContent>
<div className="text-3xl font-bold">{overallStats.averagePassRate.toFixed(1)}%</div>
<p className="text-xs text-muted-foreground">70% passing threshold</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Localize hardcoded threshold text.

The passing threshold text should be localized.

-            <p className="text-xs text-muted-foreground">70% passing threshold</p>
+            <p className="text-xs text-muted-foreground">{t("passing_threshold", { threshold: 70 })}</p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<p className="text-xs text-muted-foreground">70% passing threshold</p>
<p className="text-xs text-muted-foreground">
{t("passing_threshold", { threshold: 70 })}
</p>
🤖 Prompt for AI Agents
In
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx
at line 110, the text "70% passing threshold" is hardcoded and needs to be
localized. Replace the hardcoded string with a call to the localization function
or component used in the project, passing the appropriate key or message ID for
this text so it can be translated based on the user's locale.

<BarChart3 className="h-8 w-8" />
{t("title")}
</h1>
<p className="text-muted-foreground">Comprehensive analytics for all quizzes in this set</p>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Localize hardcoded description text.

The hardcoded string should be moved to the localization files for consistency.

-          <p className="text-muted-foreground">Comprehensive analytics for all quizzes in this set</p>
+          <p className="text-muted-foreground">{t("description")}</p>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<p className="text-muted-foreground">Comprehensive analytics for all quizzes in this set</p>
<p className="text-muted-foreground">{t("description")}</p>
🤖 Prompt for AI Agents
In
apps/upskii/src/app/[locale]/(dashboard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx
at line 54, the description text is hardcoded. To fix this, move the string
"Comprehensive analytics for all quizzes in this set" to the appropriate
localization file and replace the hardcoded text with a localized string
reference using the localization function or hook used in the project.

Copy link

codecov bot commented Jun 4, 2025

Codecov Report

Attention: Patch coverage is 0% with 2123 lines in your changes missing coverage. Please review.

Project coverage is 0.85%. Comparing base (cf76472) to head (1b1d941).
Report is 165 commits behind head on main.

Files with missing lines Patch % Lines
...(dashboard)/[wsId]/quiz-sets/[setId]/take/page.tsx 0.00% 471 Missing and 1 partial ⚠️
...oard)/[wsId]/quiz-sets/[setId]/statistics/page.tsx 0.00% 383 Missing and 1 partial ⚠️
...orkspaces/[wsId]/quiz-sets/[setId]/submit/route.ts 0.00% 223 Missing and 1 partial ⚠️
...rkspaces/[wsId]/quiz-sets/[setId]/results/route.ts 0.00% 183 Missing and 1 partial ⚠️
.../workspaces/[wsId]/quiz-sets/[setId]/take/route.ts 0.00% 148 Missing and 1 partial ⚠️
[...Id]/quiz-sets/[setId]/take/quiz-status-sidebar.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/3010?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fquiz-sets%2F%5BsetId%5D%2Ftake%2Fquiz-status-sidebar.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vcXVpei1zZXRzL1tzZXRJZF0vdGFrZS9xdWl6LXN0YXR1cy1zaWRlYmFyLnRzeA==) 0.00% 124 Missing and 1 partial ⚠️
...ses/[courseId]/modules/[moduleId]/quizzes/page.tsx 0.00% 118 Missing ⚠️
[...eId]/modules/[moduleId]/quizzes/client-quizzes.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/3010?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcourses%2F%5BcourseId%5D%2Fmodules%2F%5BmoduleId%5D%2Fquizzes%2Fclient-quizzes.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY291cnNlcy9bY291cnNlSWRdL21vZHVsZXMvW21vZHVsZUlkXS9xdWl6emVzL2NsaWVudC1xdWl6emVzLnRzeA==) 0.00% 106 Missing ⚠️
[...Id]/courses/[courseId]/modules/[moduleId]/page.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/3010?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fcourses%2F%5BcourseId%5D%2Fmodules%2F%5BmoduleId%5D%2Fpage.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vY291cnNlcy9bY291cnNlSWRdL21vZHVsZXMvW21vZHVsZUlkXS9wYWdlLnRzeA==) 0.00% 62 Missing ⚠️
[...Id]/quiz-sets/[setId]/take/time-elapsed-status.tsx](https://app.codecov.io/gh/tutur3u/platform/pull/3010?src=pr&el=tree&filepath=apps%2Fupskii%2Fsrc%2Fapp%2F%5Blocale%5D%2F%28dashboard%29%2F%5BwsId%5D%2Fquiz-sets%2F%5BsetId%5D%2Ftake%2Ftime-elapsed-status.tsx&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tutur3u#diff-YXBwcy91cHNraWkvc3JjL2FwcC9bbG9jYWxlXS8oZGFzaGJvYXJkKS9bd3NJZF0vcXVpei1zZXRzL1tzZXRJZF0vdGFrZS90aW1lLWVsYXBzZWQtc3RhdHVzLnRzeA==) 0.00% 61 Missing and 1 partial ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3010      +/-   ##
==========================================
- Coverage    0.85%    0.85%   -0.01%     
==========================================
  Files        2453     2462       +9     
  Lines      299212   301214    +2002     
  Branches     2954     2963       +9     
==========================================
  Hits         2565     2565              
- Misses     294544   296537    +1993     
- Partials     2103     2112       +9     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vhpx vhpx added the upskii label Jun 5, 2025
@vhpx vhpx marked this pull request as draft June 5, 2025 16:09
@vhpx vhpx changed the title Result monitoring for quiz sets Add result monitoring for quiz sets Jun 6, 2025
@vhpx vhpx closed this Jun 16, 2025
@vhpx vhpx deleted the feat/upskii/quiz-set-statistics branch June 16, 2025 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants