Skip to content
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

chore: cleanup formulations and variables related to old live session #4361

Merged
merged 7 commits into from
Nov 6, 2024

Conversation

sjschlapbach
Copy link
Member

@sjschlapbach sjschlapbach commented Nov 6, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Transitioned terminology from "sessions" to "live quizzes" across the platform for clarity.
    • Enhanced feedback management in live quizzes, ensuring ownership validation for responses.
  • Documentation Updates

    • Updated various documents to reflect the new terminology, including gamification, grading logic, and tutorials.
    • Improved clarity in instructions for course management and group activities.
  • Bug Fixes

    • Resolved inconsistencies in data attributes and variable names in the UI related to live quizzes.
  • Testing Improvements

    • Updated Cypress tests to reflect changes in terminology and ensure accurate testing of live quiz functionalities.

Copy link

aviator-app bot commented Nov 6, 2024

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

This PR was merged manually (without Aviator). Merging manually can negatively impact the performance of the queue. Consider using Aviator next time.


See the real-time status of this PR on the Aviator webapp.
Use the Aviator Chrome Extension to see the status of your PR within GitHub.

Copy link

gitguardian bot commented Nov 6, 2024

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
Once a secret has been leaked into a git repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link

coderabbitai bot commented Nov 6, 2024

Warning

Rate limit exceeded

@sjschlapbach has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 31 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 1076670 and 4b02274.

📝 Walkthrough
📝 Walkthrough
📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request introduces significant changes across multiple files, primarily focusing on transitioning terminology from "session" to "live quiz" and updating related functionality. Key modifications include altering data models in scripts, renaming components, and adjusting documentation to reflect the new terminology. The changes aim to enhance clarity and consistency in the codebase, ensuring that all references align with the concept of live quizzes rather than sessions.

Changes

File Path Change Summary
apps/backend-docker/scripts/checkRedisConsistency.ts Changed data model from liveSession to liveQuiz, updated filtering condition and variable names.
apps/backend-docker/scripts/fixPointsInconsistency.ts Renamed SESSION_ID to QUIZ_ID, updated leaderboard data retrieval from session to quiz context.
apps/docs/docs/gamification/experience.mdx Updated terminology from "learning elements and micro sessions" to "practice quizzes and microlearnings."
apps/docs/docs/gamification/grading_logic.mdx Replaced "live sessions" with "live quizzes" throughout the document, clarified point allocation details.
apps/docs/docs/tutorials/course_management.mdx Added clarification on manual group creation during group formation.
apps/docs/docs/tutorials/element_management.mdx Specified that elements are persistent within existing quizzes rather than sessions.
apps/docs/docs/tutorials/group_activity.mdx Updated terminology from "session" to "activity," refined grading section for clarity.
apps/docs/docs/tutorials/live_quiz.mdx Replaced "session" with "quiz" for consistency, made minor grammatical adjustments.
apps/docs/docs/tutorials/live_qa.mdx Changed "during a Live Quiz session" to "during its execution."
apps/docs/docs/tutorials/microlearning.mdx Standardized usage of "microlearning" and updated terminology for clarity.
apps/docs/docs/tutorials/practice_quiz.mdx Updated capitalization of "Practice Quiz" to "practice quiz" for consistency.
apps/docs/src/constants.tsx Added new constants for features and use cases, updated descriptions for clarity.
apps/docs/src/pages/development.tsx Updated "sessions" to "quizzes" in the "Learning Analytics" section.
apps/frontend-control/src/components/Layout.tsx Changed sessionId prop to quizId in Layout component.
apps/frontend-control/src/components/layout/MobileMenuBar.tsx Renamed sessionId to quizId in MobileMenuBar component.
apps/frontend-control/src/components/liveQuizzes/EmbeddingModal.tsx Renamed dataLiveSession to dataLiveQuiz, updated data fetching logic.
apps/frontend-control/src/components/liveQuizzes/LiveQuizLists.tsx Renamed component and updated props to reflect live quiz terminology.
apps/frontend-control/src/components/liveQuizzes/StartModal.tsx Renamed variable startingSession to startingLiveQuiz, updated button data attributes.
apps/frontend-control/src/components/toasts/ErrorStartToast.tsx Updated error message key from sessionStartFailed to liveQuizStartFailed.
apps/frontend-control/src/pages/course/[id].tsx Renamed SessionLists to LiveQuizLists, updated prop names accordingly.
apps/frontend-control/src/pages/course/unassigned.tsx Renamed SessionLists to LiveQuizLists, updated variable names and logic for unassigned quizzes.
apps/frontend-control/src/pages/index.tsx Updated navigation labels from "sessions" to "live quizzes."
apps/frontend-control/src/pages/session/[id].tsx Renamed RunningSession to RunningLiveQuiz, updated state variables and logic.
apps/frontend-manage/src/components/activities/creation/CompletionStep.tsx Updated button data attribute to reflect live quiz context.
apps/frontend-manage/src/components/activities/creation/WizardNavigation.tsx Updated button data attributes for navigation to reflect activity context.
apps/frontend-manage/src/components/activities/creation/liveQuiz/LiveQuizWizard.tsx Updated validation messages for form fields to reflect new terminology.
apps/frontend-manage/src/components/activities/creation/liveQuiz/submitLiveQuizForm.tsx Renamed interface from LiveSessionFormProps to LiveQuizFormProps.
apps/frontend-manage/src/components/courses/CourseGamificationInfos.tsx Updated course property type to exclude liveQuizzes.
apps/frontend-manage/src/components/liveQuiz/LiveQuiz.tsx Renamed state variable from selectedSession to selectedLiveQuiz, updated data attributes.
packages/i18n/messages/de.ts Updated translations to replace "session" with "live quiz" and added new keys for live quizzes.
packages/i18n/messages/en.ts Updated localization keys to reflect new terminology for live quizzes.
packages/prisma/src/data/data/TEST.ts Removed SessionStatus, updated LIVE_QUIZZES entries to include "Live Quiz" in titles.
packages/prisma/src/data/seedTEST.ts Simplified seeding logic for live quizzes, removed legacy comments.
packages/shared-components/src/questions/LiveQuizProgress.tsx Renamed SessionProgress to LiveQuizProgress, updated interface and function signatures.

Possibly related PRs

Suggested reviewers

  • rschlaefli

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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

cypress bot commented Nov 6, 2024

klicker-uzh    Run #3576

Run Properties:  status check passed Passed #3576  •  git commit ec964c8c06: enhance(packages/graphql): store correctness along open answers in live quiz res...
Project klicker-uzh
Branch Review v3-new-live-quiz
Run status status check passed Passed #3576
Run duration 11m 14s
Commit git commit ec964c8c06: enhance(packages/graphql): store correctness along open answers in live quiz res...
Committer Julius Schlapbach
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 140
View all changes introduced in this branch ↗︎

Copy link

cypress bot commented Nov 6, 2024

klicker-uzh    Run #3584

Run Properties:  status check passed Passed #3584  •  git commit ea7c3e8ff0 ℹ️: Merge 4b022746e6b055d2ebced241176dcc5ceeb2fc5b into ec964c8c063a036e366e804b8112...
Project klicker-uzh
Branch Review cleanup-sessions-content
Run status status check passed Passed #3584
Run duration 11m 15s
Commit git commit ea7c3e8ff0 ℹ️: Merge 4b022746e6b055d2ebced241176dcc5ceeb2fc5b into ec964c8c063a036e366e804b8112...
Committer Julius Schlapbach
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 140
View all changes introduced in this branch ↗︎

@sjschlapbach sjschlapbach changed the base branch from v3 to v3-new-live-quiz November 6, 2024 13:11
Copy link

@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.

Caution

Inline review comments failed to post. This is likely due to GitHub's limits when posting large numbers of comments.

Actionable comments posted: 14

🧹 Outside diff range and nitpick comments (49)
apps/backend-docker/scripts/checkRedisConsistency.ts (1)

Line range hint 4-31: Consider adding error handling

The script could benefit from proper error handling for both database and Redis operations. Consider:

  1. Adding try-catch blocks around Prisma and Redis operations
  2. Implementing proper cleanup (closing connections)
  3. Adding logging for better observability

Example implementation:

async function run() {
  const prisma = new PrismaClient()
  const redisExec = new Redis({/*...*/})
  
  try {
    const quizzes = await prisma.liveQuiz.findMany({/*...*/})
    let count = 0
    
    for (const quiz of quizzes) {
      try {
        const invalidKeys = await redisExec.keys(`s:${quiz.id}:*`)
        count += invalidKeys.length
      } catch (error) {
        console.error(`Failed to check keys for quiz ${quiz.id}:`, error)
      }
    }
    
    console.log(`Found ${count} invalid keys`)
  } catch (error) {
    console.error('Script failed:', error)
    process.exit(1)
  } finally {
    await Promise.all([
      prisma.$disconnect(),
      redisExec.quit()
    ])
  }
}
apps/frontend-manage/src/components/evaluation/elements/LiveQuizEvaluationQRCode.tsx (1)

14-14: Consider updating URL structure to match new terminology.

While the variable has been renamed to use "liveQuiz", the URL structure still uses "/session/". This creates an inconsistency in terminology.

-  const liveQuizRelativeLink = `/session/${router.query.id}`
+  const liveQuizRelativeLink = `/live-quiz/${router.query.id}`

Note: This change would require corresponding updates to the routing configuration.

Also applies to: 24-24

apps/backend-docker/scripts/fixPointsInconsistency.ts (1)

Line range hint 24-47: Improve script execution mode and logging.

The script appears to be in a "dry run" mode with commented-out updates, but this isn't clearly indicated. Additionally, there's no summary of the total changes that would be made.

Consider these improvements:

+const DRY_RUN = true // Add flag to control execution mode
+let totalAdjustments = 0
+let totalParticipants = 0

 const results = await Promise.allSettled(
   Object.entries(quizLB).map(async ([participantId, score]) => {
+    totalParticipants++
     const lbEntry = await prisma.leaderboardEntry.findFirst({
       where: {
         participantId,
         type: 'COURSE',
         courseId: COURSE_ID,
       },
     })

     if (!lbEntry) {
       console.log('no leaderboard entry found for', participantId)
     } else {
       const adjustedScore = lbEntry.score - parseInt(score) * FAILURES
+      totalAdjustments++

       console.log('score adjustment', lbEntry.score, '->', adjustedScore)

-      // await prisma.leaderboardEntry.update({
-      //   where: {
-      //     id: lbEntry.id,
-      //   },
-      //   data: {
-      //     score: adjustedScore,
-      //   },
-      // })
+      if (!DRY_RUN) {
+        await prisma.leaderboardEntry.update({
+          where: {
+            id: lbEntry.id,
+          },
+          data: {
+            score: adjustedScore,
+          },
+        })
+      }
     }
   })
 )

+console.log(`
+Summary:
+- Total participants processed: ${totalParticipants}
+- Total score adjustments: ${totalAdjustments}
+- Mode: ${DRY_RUN ? 'DRY RUN' : 'LIVE'}
+`)
cypress/cypress/e2e/C-control-workflow.cy.ts (2)

39-39: Consider adding state transition assertions.

While the test covers the basic workflow, it could benefit from additional assertions to verify the quiz state at each step:

  • After quiz start
  • During block activation/deactivation
  • After quiz end

Consider adding assertions like:

// After starting the quiz
cy.get('[data-cy="quiz-status"]').should('contain', 'running')

// After block activation
cy.get('[data-cy="block-status"]').should('contain', 'active')

// After quiz end
cy.get('[data-cy="quiz-status"]').should('contain', 'ended')

Also applies to: 56-61, 68-69, 71-71, 74-78


81-81: TODO: Implement student interaction test cases.

The test suite would benefit from additional test cases covering:

  1. Student joining the quiz
  2. Student submitting answers
  3. Verification of answer submissions
  4. Response visualization in the control interface

Would you like me to help create these additional test cases or create a GitHub issue to track this enhancement?

apps/frontend-manage/src/components/liveQuiz/cockpit/LiveQuizQRModal.tsx (1)

Line range hint 1-97: Consider adding prop type definitions.

While the component works correctly, consider enhancing type safety and documentation by:

  1. Extracting the props interface
  2. Adding JSDoc comments for the component
+interface LiveQuizQRModalProps {
+  /** The ID of the live quiz to generate QR codes for */
+  quizId: string
+}

+/**
+ * Modal component that displays QR codes for both account-level and quiz-specific access
+ */
-function LiveQuizQRModal({ quizId }: { quizId: string }): React.ReactElement {
+function LiveQuizQRModal({ quizId }: LiveQuizQRModalProps): React.ReactElement {
apps/frontend-manage/src/components/activities/creation/liveQuiz/submitLiveQuizForm.tsx (3)

Line range hint 7-14: Consider adding proper types for GraphQL mutations.

The interface uses any type for createLiveQuiz and editLiveQuiz props. Consider using the generated GraphQL mutation types for better type safety.

interface LiveQuizFormProps {
  id?: string
  editMode: boolean
  values: LiveQuizFormValues
-  createLiveQuiz: any
-  editLiveQuiz: any
+  createLiveQuiz: MutationFunction<CreateLiveQuizMutation, CreateLiveQuizMutationVariables>
+  editLiveQuiz: MutationFunction<EditLiveQuizMutation, EditLiveQuizMutationVariables>
  setIsWizardCompleted: (isCompleted: boolean) => void
  setErrorToastOpen: (isOpen: boolean) => void
}

Line range hint 44-98: Add input validation for numeric conversions.

The code performs multiple parseInt operations without proper validation or error handling. Consider adding safeguards for these conversions:

+ const parseIntSafe = (value: string, fallback: number): number => {
+   const parsed = parseInt(value)
+   return isNaN(parsed) ? fallback : parsed
+ }

const liveQuiz = await editLiveQuiz({
  variables: {
    // ...other fields
-   multiplier: values.courseId !== '' ? parseInt(values.multiplier) : 1,
-   maxBonusPoints: parseInt(String(values.maxBonusPoints)),
-   timeToZeroBonus: parseInt(String(values.timeToZeroBonus)),
+   multiplier: values.courseId !== '' ? parseIntSafe(values.multiplier, 1) : 1,
+   maxBonusPoints: parseIntSafe(String(values.maxBonusPoints), 0),
+   timeToZeroBonus: parseIntSafe(String(values.timeToZeroBonus), 0),
    // ...other fields
  },

Line range hint 100-104: Enhance error handling with more specific error messages.

The current error handling only logs to console and shows a generic error toast. Consider adding more specific error handling:

  } catch (error) {
-   console.log('error: ', error)
+   console.error('Failed to submit live quiz form:', {
+     error,
+     mode: editMode ? 'edit' : 'create',
+     quizId: id,
+   })
+   const errorMessage = error instanceof Error ? error.message : 'Unknown error occurred'
    setErrorToastOpen(true)
+   // Consider passing error message to toast component for better user feedback
  }
apps/frontend-manage/src/components/liveQuiz/cockpit/LiveQuizAbortionConfirmations.tsx (1)

Line range hint 14-107: Consider extracting confirmation items into a separate component.

While the renaming changes look good, the component could benefit from some structural improvements:

  1. The confirmation items follow a similar pattern and could be extracted into a reusable component
  2. The confirmation state updates could be simplified using a single handler function

Here's a suggested approach for extracting the confirmation items:

interface ConfirmationConfig {
  key: keyof LiveQuizAbortionConfirmationType;
  getLabel: (summary: RunningLiveQuizSummary) => string;
  getCount: (summary: RunningLiveQuizSummary) => number;
  dataCy: string;
}

const CONFIRMATION_CONFIGS: ConfirmationConfig[] = [
  {
    key: 'deleteResponses',
    getLabel: (summary) => summary.numOfResponses === 0 
      ? t('manage.cockpit.noResponsesToDelete')
      : t('manage.cockpit.deleteResponses', { number: summary.numOfResponses }),
    getCount: (summary) => summary.numOfResponses,
    dataCy: 'lq-deletion-responses-confirm'
  },
  // ... similar configs for other confirmation types
];

This would allow you to map over the configs and reduce duplication.

apps/frontend-manage/src/pages/sessions/[id]/cockpit.tsx (1)

Line range hint 94-118: Update route path to maintain consistent terminology.

While the component props have been updated to use "quiz" terminology, the router path still uses the old "sessions" terminology.

Consider updating the route path:

-            router.push('/sessions')
+            router.push('/live-quizzes')
apps/frontend-manage/src/components/liveQuiz/cockpit/CancelLiveQuizModal.tsx (1)

Line range hint 57-77: Add error handling for cache operations.

The cache update logic could be more robust by handling potential cache read failures.

 update(cache, res) {
-  const data = cache.readQuery({
-    query: GetUserRunningLiveQuizzesDocument,
-  })
+  try {
+    const data = cache.readQuery({
+      query: GetUserRunningLiveQuizzesDocument,
+    })
+    if (!data) {
+      console.warn('Cache miss for user running live quizzes')
+      return
+    }
+    cache.writeQuery({
+      query: GetUserRunningLiveQuizzesDocument,
+      data: {
+        userRunningLiveQuizzes:
+          data.userRunningLiveQuizzes?.filter(
+            (q) => q.id !== res.data?.cancelLiveQuiz?.id
+          ) ?? [],
+      },
+    })
+  } catch (error) {
+    console.error('Failed to update cache:', error)
+  }
}
apps/frontend-pwa/src/pages/join/[shortname].tsx (2)

125-125: LGTM, but consider updating redirect path.

The comment update aligns with the terminology transition. However, for complete consistency, consider updating the redirect URL path from /session/${result.data.shortnameQuizzes[0].id} to use "live-quiz" instead of "session".

  return {
    redirect: {
-       destination: `/session/${result.data.shortnameQuizzes[0].id}`,
+       destination: `/live-quiz/${result.data.shortnameQuizzes[0].id}`,
        permanent: false,
    },
  }

Line range hint 1-156: Consider comprehensive terminology update.

While the changes align with the PR objectives, there are still several instances of "session" terminology in the file that could be updated for complete consistency:

  1. Link component URL path: href={/session/${quiz.id}}
  2. Redirect URL path in getServerSideProps

Consider creating a follow-up task to update these URL paths if they're not covered by another PR. This would ensure complete alignment with the new "live quiz" terminology across the codebase.

Would you like me to create a GitHub issue to track these remaining terminology updates?

apps/frontend-control/src/components/liveQuizzes/LiveQuizLists.tsx (3)

15-17: Consider enhancing type safety with a dedicated LiveQuiz type.

Instead of using an inline type, consider creating a dedicated LiveQuiz interface for better reusability and maintainability.

+interface LiveQuiz {
+  id: string
+  name: string
+}
+
 interface LiveQuizListsProps {
-  runningLiveQuizzes: { id: string; name: string }[]
-  plannedLiveQuizzes: { id: string; name: string }[]
+  runningLiveQuizzes: LiveQuiz[]
+  plannedLiveQuizzes: LiveQuiz[]
 }

20-30: Consider combining related state variables and improving naming.

The startId and startName states are always used together. Consider combining them into a single state object. Also, errorToast could be more descriptive.

-const [startId, setStartId] = useState('')
-const [startName, setStartName] = useState('')
+const [selectedQuiz, setSelectedQuiz] = useState<{id: string, name: string} | null>(null)
-const [errorToast, setErrorToast] = useState(false)
+const [showStartError, setShowStartError] = useState(false)

Line range hint 71-106: Consider extracting common quiz list item component.

Both running and planned quizzes sections share similar structure. Consider extracting a common QuizListItem component to reduce code duplication.

interface QuizListItem {
  quiz: LiveQuiz
  icon: IconDefinition
  onMainAction: (quiz: LiveQuiz) => void
  onPPTClick: (quizId: string) => void
  mainActionLabel?: string
}

function QuizListItem({ quiz, icon, onMainAction, onPPTClick, mainActionLabel }: QuizListItem) {
  return (
    <div className="flex flex-row items-center gap-2">
      <ListButton
        icon={icon}
        label={quiz.name}
        onClick={() => onMainAction(quiz)}
        data={{ cy: `start-live-quiz-${quiz.name}` }}
      />
      <Button
        onClick={() => onPPTClick(quiz.id)}
        className="bg-uzh-grey-40 border-uzh-grey-100 h-full rounded-md border border-solid p-2"
        data={{ cy: `ppt-link-${quiz.name}` }}
      >
        <Button.Icon className="mr-2">
          <FontAwesomeIcon icon={faPersonChalkboard} />
        </Button.Icon>
        <Button.Label>PPT</Button.Label>
      </Button>
    </div>
  )
}
apps/frontend-manage/src/pages/sessions/index.tsx (2)

14-14: Consider moving this file to a more appropriate directory.

The file is still located in the sessions directory despite being renamed to LiveQuizList. For better code organization and consistency with the new terminology, consider moving this file to a more appropriate directory like pages/live-quizzes/.

Also applies to: 16-16


54-95: Consider extracting repeated quiz list section into a reusable component.

The code structure for rendering different quiz types (running, scheduled, prepared, completed) is very similar. Consider extracting this pattern into a reusable component to reduce code duplication:

type QuizSectionProps = {
  quizzes: any[];
  titleTranslationKey: string;
}

function QuizSection({ quizzes, titleTranslationKey }: QuizSectionProps) {
  const t = useTranslations()
  if (!quizzes?.length) return null
  
  return (
    <div>
      <H2>{t(titleTranslationKey)}</H2>
      <div className="flex flex-col gap-2">
        {quizzes.map((quiz) => (
          <LiveQuiz key={quiz.id} quiz={quiz} />
        ))}
      </div>
    </div>
  )
}

This would simplify the main render logic and make it more maintainable.

apps/docs/docs/tutorials/element_management.mdx (1)

99-99: Approve terminology update with minor suggestion for clarity.

The update from "sessions" to "quizzes" aligns with the PR objectives. However, the sentence could be clearer about element persistence.

Consider this minor rewording for better clarity:

-Most elements can be used in any learning activity, with some restrictions. For detailed information on embedding elements into different activities, refer to the following sections. Remember, elements are persistent within existing quizzes, even if deleted from your element pool.
+Most elements can be used in any learning activity, with some restrictions. For detailed information on embedding elements into different activities, refer to the following sections. Note: Elements used in existing quizzes remain functional even if removed from your element pool.
apps/docs/docs/tutorials/microlearning.mdx (1)

40-41: Consider adding a cross-reference link to Live Quiz documentation.

The distinction between microlearning and Live Quiz course requirements is well explained. Consider adding a link to the Live Quiz documentation when mentioning the difference in behavior.

-4. Course: In this field, the microlearning has to be assigned to a course. Note that this is different from the Live Quiz, which can be run independently of a course.
+4. Course: In this field, the microlearning has to be assigned to a course. Note that this is different from the [Live Quiz](/tutorials/live_quiz), which can be run independently of a course.
apps/docs/docs/tutorials/lti_integration.mdx (1)

Line range hint 1-24: Consider standardizing quiz-related terminology throughout the document.

The document uses slightly different terms for similar concepts in different sections. Consider standardizing the terminology for consistency:

  • "Live Quiz and Q&A" vs "live quizzes and Q&A quizzes"
  • "practice quizzes / microlearning / live quizzes"

This would improve clarity and reduce potential confusion for users integrating KlickerUZH with their LMS.

Also applies to: 26-200

apps/frontend-manage/src/components/interaction/feedbacks/FeedbackChannel.tsx (1)

Line range hint 1-1: Consider cleaning up commented code sections.

There are several commented-out sections in the file:

  • TODO comment at the top
  • Notification-related code and hooks
  • Survey banner implementation

Consider either:

  1. Removing these sections if they're no longer needed
  2. Creating separate issues to track their implementation if they're planned features

Also applies to: 41-57, 159-176

apps/docs/docs/gamification/grading_logic.mdx (2)

7-7: Improve sentence clarity and conciseness.

The sentence structure can be simplified while maintaining the same information. Consider this revision:

-The presented grading approach assumes that all considered questions have a defined correct solution (or possibly multiple solutions), as this is required in asynchronous activities, except for free-text questions. During live quizzes where questions without sample solutions were used, the participants are awarded a fixed amount of 10 points for taking part in each poll. Please also note that the [grading approach for live quizzes](#grading-in-live-quizzes) slightly extends the logic of asynchronous activities and that some element types are only available in select activities.
+The presented grading approach assumes that all questions (except free-text) have defined correct solutions, as required in asynchronous activities. For live quizzes without sample solutions, participants receive 10 points for each poll response. Note that the [grading approach for live quizzes](#grading-in-live-quizzes) extends the asynchronous activity logic, and some element types are only available in select activities.
🧰 Tools
🪛 LanguageTool

[style] ~7-~7: The word “also” tends to be overused. Consider using a formal alternative to strengthen your wording.
Context: ...10 points for taking part in each poll. Please also note that the [grading approach for liv...

(PLEASE_ALSO_CHECK)


73-75: Consider restructuring the bonus points explanation.

The explanation of bonus points could be clearer by breaking down the components:

-To incentivize fast and correct answers during live quizzes, additional bonus points are awarded. Starting time with the first correct answer, players will receive up to 45 points (default setting), depending on the time that passed between the first correct answer and theirs. By default, the slope to zero points is implemented with a duration of 20 seconds.

-The corresponding resulting point curves for correct and wrong answers during live quizzes, when starting time with the first correct response, are shown in the plot below (not considering multipliers).
+Bonus points in live quizzes are structured as follows:
+- Base: Up to 45 bonus points (default setting)
+- Timing: Points decrease linearly over 20 seconds
+- Start trigger: Timer begins with the first correct answer
+- Calculation: Points awarded based on time difference between first correct answer and participant's response
+
+The graph below illustrates these point curves for correct and wrong answers (excluding multipliers).
apps/docs/docs/tutorials/practice_quiz.mdx (3)

44-44: Maintain consistent capitalization of "quiz".

For consistency with the rest of the documentation, "Quiz" should be lowercase in "repeat the Quiz".

-6. Repetition interval: practice quizzes are characterized by their spaced repetition. Here, the period is chosen after which the participants can repeat the Quiz.
+6. Repetition interval: practice quizzes are characterized by their spaced repetition. Here, the period is chosen after which the participants can repeat the quiz.

86-86: Fix typo in publishing notice.

There's a typo in the publishing notice.

-   - ...publish it. Not that publishing a practice quiz or microlearning makes the item visible to all participants. This process cannot be undone. Changes to the content of an item cannot be made after publishing.
+   - ...publish it. Note that publishing a practice quiz or microlearning makes the item visible to all participants. This process cannot be undone. Changes to the content of an item cannot be made after publishing.

46-46: Improve conciseness in availability description.

Consider using "immediately" instead of "at the moment" for better readability.

-the practice quiz will become available at the moment you publish it on the course overview
+the practice quiz will become available immediately when you publish it on the course overview
🧰 Tools
🪛 LanguageTool

[style] ~46-~46: For conciseness, consider replacing this expression with an adverb.
Context: ...the practice quiz will become available at the moment you publish it on the course overview a...

(AT_THE_MOMENT)

apps/frontend-pwa/src/pages/session/[id].tsx (2)

Line range hint 1-270: Consider further terminology consistency improvements.

While the translation key has been updated, there are still mixed references to both "session" and "live quiz" in the codebase:

  1. The file path still uses "session" (/pages/session/[id].tsx)
  2. The handleNewResponse function uses sessionId parameter

Consider:

  1. Planning a follow-up PR to update the file structure from session/[id].tsx to live-quiz/[id].tsx
  2. Updating the parameter name in handleNewResponse:
- sessionId: id,
+ liveQuizId: id,

Line range hint 41-270: Consider renaming the Index component for better clarity.

The component name "Index" is generic and doesn't convey its purpose. Consider renaming it to better reflect its functionality.

- function Index({ id }: { id: string })
+ function LiveQuizPage({ id }: { id: string })

Don't forget to update the export at the bottom of the file:

- export default Index
+ export default LiveQuizPage
apps/docs/docs/tutorials/course_management.mdx (1)

90-90: LGTM with a minor suggestion for clarity.

The added documentation about manual group creation is valuable and aligns well with the transition to "live quiz" terminology. However, consider rephrasing "in a single in-class quizzes" to "in a single in-class quiz" or "in in-class quizzes" for better grammatical consistency.

-This allows you to use randomized group formation in a single in-class quizzes instead of across a longer timespan.
+This allows you to use randomized group formation in a single in-class quiz instead of across a longer timespan.
packages/graphql/src/services/feedbacks.ts (1)

219-219: LGTM with suggestion: Consider enhancing error handling.

The comment update correctly reflects the new terminology. However, consider improving error handling to provide more specific error cases.

Consider this enhancement:

 export async function pinFeedback(
   { id, isPinned }: { id: number; isPinned: boolean },
   ctx: ContextWithUser
 ) {
   const feedback = await ctx.prisma.feedback.findUnique({
     where: { id },
     include: {
       liveQuiz: true,
     },
   })

-  if (!feedback || feedback.liveQuiz!.ownerId !== ctx.user.sub) return null
+  if (!feedback) {
+    throw new Error('Feedback not found')
+  }
+  
+  if (feedback.liveQuiz!.ownerId !== ctx.user.sub) {
+    throw new Error('Unauthorized: Only the quiz owner can pin feedback')
+  }

   const updatedFeedback = await ctx.prisma.feedback.update({
     // ... rest of the function

This change would:

  1. Provide clearer error messages for different failure scenarios
  2. Make it easier to handle errors appropriately in the client
apps/frontend-control/src/pages/session/[id].tsx (1)

Line range hint 56-69: Consider enhancing error handling for the query.

While the query implementation is good, consider adding error boundaries or retry logic to handle network issues gracefully, especially since this is a live interface with polling.

 const {
   loading: quizLoading,
   error: quizError,
   data: quizData,
 } = useQuery(GetControlLiveQuizDocument, {
   variables: {
     id: router.query.id as string,
   },
   pollInterval: 1000,
   skip: !router.query.id,
+  onError: (error) => {
+    console.error('Failed to fetch quiz data:', error)
+    // Implement retry logic or show user-friendly error message
+  }
 })
apps/docs/docs/tutorials/group_activity.mdx (1)

Line range hint 9-9: Fix typo in "Currently".

There's a typo in the word "Currrently" (three 'r's).

-Currrently, student submissions need to be graded manually, but we are evaluating possibilities
+Currently, student submissions need to be graded manually, but we are evaluating possibilities
🧰 Tools
🪛 LanguageTool

[grammar] ~40-~40: The verb ‘recommend’ is used with the gerund form.
Context: ...activity. While not required, we highly recommend to provide general information about the group act...

(ADMIT_ENJOY_VB)

apps/frontend-manage/src/components/liveQuiz/cockpit/LiveQuizTimeline.tsx (2)

40-51: Consider improving interface prop definitions.

The interface could be improved by:

  1. Making required props explicit by not marking them as optional
  2. Grouping related props together
  3. Adding JSDoc comments for better documentation
 interface LiveQuizTimelineProps {
+  // Required core props
+  quizId: string
+  quizName: string
+  
+  // Timeline block related props
   blocks?: QuizTimelineBlock[]
-  quizName: string
+  startedAt?: string
+  isEvaluationPublic?: boolean
+  
+  // Handler functions
   handleEndLiveQuiz: () => void
   handleTogglePublicEvaluation: () => void
   handleOpenBlock: (blockId: number) => void
   handleCloseBlock: (blockId: number) => void
-  isEvaluationPublic?: boolean
-  quizId: string
-  startedAt?: string
+  
+  // UI state
   loading?: boolean
 }

Line range hint 92-135: Consider extracting timeline logic into a custom hook.

The timeline state management logic is complex and could be extracted into a custom hook for better maintainability and reusability. This would also make the component more focused on rendering.

Example structure:

function useLiveQuizTimeline(blocks: QuizTimelineBlock[]) {
  const [buttonState, setButtonState] = useState<'firstBlock' | 'blockActive' | 'nextBlock' | 'endQuiz'>('firstBlock')
  const [activeBlockId, setActiveBlockId] = useState(-1)
  const [lastActiveBlockId, setLastActiveBlockId] = useState(-1)
  const [inCooldown, setInCooldown] = useState(false)

  useEffect(() => {
    // Current timeline logic
  }, [activeBlockId, blocks, lastActiveBlockId])

  return {
    buttonState,
    activeBlockId,
    lastActiveBlockId,
    inCooldown,
    setInCooldown
  }
}
packages/prisma/src/data/data/TEST.ts (1)

Line range hint 353-355: Consider standardizing "Live Quiz" capitalization in achievement descriptions

For consistency with the updated quiz names, consider capitalizing "Live Quiz" in achievement descriptions. For example:

  • "You have reached first place in a live quiz" → "You have reached first place in a Live Quiz"
-    descriptionDE: 'Du hast einen ersten Platz in einer Live Quiz erreicht.',
-    descriptionEN: 'You have reached first place in a live quiz.',
+    descriptionDE: 'Du hast einen ersten Platz in einem Live Quiz erreicht.',
+    descriptionEN: 'You have reached first place in a Live Quiz.',

Similar updates could be applied to the Vice-Champion and Vice-Vice-Champion achievement descriptions.

Also applies to: 361-363, 369-371

packages/graphql/src/services/practiceQuizzes.ts (2)

Line range hint 214-219: Consider enhancing error handling and function structure.

The error messages could be more specific to help with debugging:

  1. "Practice quiz not found" could indicate why (e.g., deleted, unauthorized).
  2. Consider splitting this large function into smaller, focused functions for better maintainability.

Example of more specific error messages:

-      throw new GraphQLError('Practice quiz not found')
+      throw new GraphQLError('Practice quiz not found: Either it was deleted or you do not have access to it')
-      throw new GraphQLError('Cannot edit a published practice quiz')
+      throw new GraphQLError('Cannot edit a published practice quiz: Unpublish it first to make changes')

Line range hint 302-302: Consider using a safer type assertion approach.

The non-null assertion operator (!) in elementMap[elem.elementId]! could be replaced with a more defensive approach to handle potential undefined values.

Example of a safer approach:

-              const element = elementMap[elem.elementId]!
+              const element = elementMap[elem.elementId]
+              if (!element) {
+                throw new GraphQLError(`Element ${elem.elementId} not found in element map`)
+              }
cypress/cypress/e2e/E-course-workflow.cy.ts (1)

602-604: LGTM! Consider adding assertion for live quiz existence.

The code correctly uses the updated "live quiz" terminology in the selectors. However, to make the test more robust, consider adding an explicit assertion to verify the live quiz exists before attempting to edit it.

 cy.get('[data-cy="live-quizzes"]').click()
 cy.contains('[data-cy="live-quiz-block"]', liveQuizName)
+cy.contains('[data-cy="live-quiz-block"]', liveQuizName).should('exist')
 cy.get(`[data-cy="edit-live-quiz-${liveQuizName}"]`).click()
cypress/cypress/e2e/H-practice-quiz-workflow.cy.ts (1)

Line range hint 1-724: Consider adding test coverage for error scenarios.

While the happy path scenarios are well covered, consider adding test cases for:

  • Network failures during quiz creation/editing
  • Concurrent editing scenarios
  • Invalid input validation
cypress/cypress/e2e/F-live-quiz-workflow.cy.ts (3)

271-297: Consider adding additional assertions for robustness.

While the test case correctly verifies the basic editing workflow, consider adding assertions for:

  • Validation of error states (e.g., empty fields)
  • Boundary conditions for input fields
  • State persistence between navigation steps

Line range hint 554-562: Replace fixed waits with more reliable waiting strategies.

Using fixed wait times (cy.wait(500)) can make tests flaky. Consider:

  • Using cy.waitUntil() or cy.should() with retries
  • Waiting for specific UI states or network requests
  • Implementing custom commands for common wait patterns

Example improvement:

// Instead of multiple cy.wait(500)
cy.get('[data-cy="next-block-timeline"]')
  .should('be.enabled')
  .click()
cy.get('[data-cy="block-status"]')
  .should('contain', 'completed')

Line range hint 1-802: Overall well-structured test suite with room for improvement.

The test suite effectively covers the main live quiz workflows with:
✅ Consistent naming and selectors
✅ Good organization of test cases
✅ Proper cleanup handling

Consider these improvements:

  • Replace fixed waits with more reliable waiting strategies
  • Add test coverage for error scenarios
  • Enhance assertions for edge cases
cypress/cypress/e2e/G-microlearning-workflow.cy.ts (1)

Line range hint 1-917: Consider organizing tests using Cypress custom commands.

While the test structure is comprehensive and well-organized, consider extracting common test patterns into custom commands to improve maintainability and reduce code duplication. For example:

  1. Cleanup operations could be moved to a custom command:
// commands.ts
Cypress.Commands.add('cleanupMicrolearning', (name: string) => {
  cy.get(`[data-cy="microlearning-actions-${name}"]`).click()
  cy.get(`[data-cy="delete-microlearning-${name}"]`).click()
  cy.get(`[data-cy="confirm-deletion-responses"]`).click()
  cy.get(`[data-cy="activity-confirmation-modal-confirm"]`).click()
})

// test file
it('Cleanup', () => {
  cy.cleanupMicrolearning(runningMLName)
})
  1. Navigation patterns could be abstracted:
// commands.ts
Cypress.Commands.add('navigateToMicrolearnings', (courseName: string) => {
  cy.get('[data-cy="courses"]').click()
  cy.get(`[data-cy="course-list-button-${courseName}"]`).click()
  cy.get('[data-cy="tab-microLearnings"]').click()
})
packages/prisma/src/data/seedTEST.ts (1)

Line range hint 179-265: LGTM! The live quiz seeding implementation is well-structured.

The implementation:

  • Properly handles quiz creation with comprehensive data structure
  • Includes appropriate error handling for missing elements
  • Maintains data consistency with proper relationships
  • Uses Promise.all for efficient parallel processing

Consider adding a comment describing the structure of the live quiz data being seeded, as this would help other developers understand the test data setup better.

packages/i18n/messages/en.ts (1)

1793-1793: Consider consistent casing for "Live Quiz".

The translations use inconsistent casing for "Live Quiz" vs "live quiz". For example:

  • Line 1819: "Running Live Quizzes"
  • Line 1821: "Planned Live Quizzes"
  • Line 1834: "live quiz"

Consider standardizing the casing across all translations for better consistency.

Also applies to: 1808-1811, 1817-1823, 1832-1834, 1838-1838

packages/i18n/messages/de.ts (2)

986-991: Consider improving activity validation messages.

The activity validation messages could be more consistent in their capitalization of "Activität".

Apply this diff to improve consistency:

-      activityName: 'Bitte geben Sie einen Namen für Ihre Aktivität ein.',
-      activityDisplayName:
-        'Bitte geben Sie einen Anzeigenamen für Ihre Aktivität ein.',
-      startDate: 'Bitte geben Sie ein Startdatum für Ihre Activität ein.',
-      endDate: 'Bitte geben Sie ein Enddatum für Ihre Activität ein.',
+      activityName: 'Bitte geben Sie einen Namen für Ihre Aktivität ein.',
+      activityDisplayName:
+        'Bitte geben Sie einen Anzeigenamen für Ihre Aktivität ein.',
+      startDate: 'Bitte geben Sie ein Startdatum für Ihre Aktivität ein.',
+      endDate: 'Bitte geben Sie ein Enddatum für Ihre Aktivität ein.',

1122-1126: Consider improving consistency in channel settings messages.

The messages about live quiz channel settings could be more consistent in their structure.

Apply this diff for better consistency:

-        'Diese Einstellung spezifiziert, ob der Live-Q&A Kanal zu Beginn des Live Quizzes aktiviert sein soll. Sie kann während des laufenden Live Quizzes jederzeit geändert werden.',
-        'Diese Einstellung spezifiziert, ob die Moderation im Live-Q&A Kanal zu Beginn des Live Quizzes aktiviert sein soll. Sie kann während der laufenden Live Quizzes jederzeit geändert werden.',
-        'Diese Einstellung spezifiziert, ob der Feedback-Kanal zu Beginn des Live Quizzes aktiviert sein soll. Sie kann während der laufenden Live Quizzes jederzeit geändert werden.',
+        'Diese Einstellung spezifiziert, ob der Live-Q&A Kanal zu Beginn des Live Quizzes aktiviert sein soll. Sie kann während des Live Quizzes jederzeit geändert werden.',
+        'Diese Einstellung spezifiziert, ob die Moderation im Live-Q&A Kanal zu Beginn des Live Quizzes aktiviert sein soll. Sie kann während des Live Quizzes jederzeit geändert werden.',
+        'Diese Einstellung spezifiziert, ob der Feedback-Kanal zu Beginn des Live Quizzes aktiviert sein soll. Sie kann während des Live Quizzes jederzeit geändert werden.',
🛑 Comments failed to post (14)
apps/frontend-manage/src/components/courses/actions/RunningLiveQuizLink.tsx (1)

17-17: ⚠️ Potential issue

Update URL path to use consistent terminology

The URL path still uses "/sessions/" which is inconsistent with the PR's objective of updating session-related terminology to "live quiz".

Consider updating the path to maintain consistency:

-<Link legacyBehavior passHref href={`/sessions/${liveQuiz.id}/cockpit`}>
+<Link legacyBehavior passHref href={`/live-quizzes/${liveQuiz.id}/cockpit`}>

Committable suggestion skipped: line range outside the PR's diff.

apps/backend-docker/scripts/fixPointsInconsistency.ts (3)

19-19: ⚠️ Potential issue

Add validation for required constants.

The script uses empty string constants for critical IDs. This could lead to unintended behavior if the script is run without proper values.

Add validation at the start of the script:

 const COURSE_ID = ''
 const QUIZ_ID = ''
+
+if (!COURSE_ID || !QUIZ_ID) {
+  console.error('COURSE_ID and QUIZ_ID must be provided')
+  process.exit(1)
+}
📝 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.

const COURSE_ID = ''
const QUIZ_ID = ''

if (!COURSE_ID || !QUIZ_ID) {
  console.error('COURSE_ID and QUIZ_ID must be provided')
  process.exit(1)
}

21-22: 🛠️ Refactor suggestion

Add error handling for Redis operations.

Redis operations could fail, and the script should handle such failures gracefully.

Add try-catch block for Redis operations:

-const quizLB = await redisExec.hgetall(`s:${QUIZ_ID}:lb`)
-const quizXP = await redisExec.hgetall(`s:${QUIZ_ID}:xp`)
+try {
+  const quizLB = await redisExec.hgetall(`s:${QUIZ_ID}:lb`)
+  const quizXP = await redisExec.hgetall(`s:${QUIZ_ID}:xp`)
+  
+  if (Object.keys(quizLB).length === 0) {
+    console.error('No leaderboard entries found for the specified quiz')
+    process.exit(1)
+  }
+} catch (error) {
+  console.error('Failed to retrieve data from Redis:', error)
+  process.exit(1)
+}

Committable suggestion skipped: line range outside the PR's diff.


22-22: 💡 Codebase verification

Remove unused Redis data retrieval

The quizXP variable is retrieved from Redis but never used in the script. The script only uses quizLB for score adjustments in the leaderboard entries. The quizXP retrieval can be safely removed.

-const quizXP = await redisExec.hgetall(`s:${QUIZ_ID}:xp`)
🔗 Analysis chain

Remove or utilize unused Redis data.

The quizXP data is retrieved but never used in the script.

Let's check if this data is used elsewhere in similar scripts:

If the data isn't needed, remove the line:

-const quizXP = await redisExec.hgetall(`s:${QUIZ_ID}:xp`)

Let me check the full context of this script to understand if this variable might be used later or if it's truly unused.


Let me try a different approach to view the file content.


Let me try one more time to get the content of the script using a different approach.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for usage of quiz XP data in other scripts
rg "quizXP" apps/backend-docker/scripts/

Length of output: 152


Script:

#!/bin/bash
# Get the full content of the script to understand the context
cat apps/backend-docker/scripts/fixPointsInconsistency.ts

Length of output: 108


Script:

#!/bin/bash
# Using ripgrep to get the content with context
rg -A 20 -B 20 "quizXP" apps/backend-docker/scripts/fixPointsInconsistency.ts

Length of output: 4615


Script:

#!/bin/bash
# Using find and cat to get the content
find apps/backend-docker/scripts -name "fixPointsInconsistency.ts" -exec cat {} \;

Length of output: 1500

apps/frontend-manage/src/components/evaluation/feedbacks/EvaluationFeedbacks.tsx (1)

26-26: 💡 Codebase verification

Props interface needs to be updated to match new terminology

The FeedbacksPrintView component's props interface still uses liveQuizName while we're transitioning to the new terminology. The interface needs to be updated to use sessionName instead.

  • apps/frontend-manage/src/components/evaluation/feedbacks/FeedbacksPrintView.tsx: Update liveQuizName to sessionName in the FeedbacksPrintViewProps interface
🔗 Analysis chain

LGTM! Verify FeedbacksPrintView props interface.

The prop passing is correctly updated to use the new terminology.

Let's verify that the FeedbacksPrintView component's props interface has been updated:

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the FeedbacksPrintView component definition
ast-grep --pattern 'interface $_ {
  $$$
  sessionName: $_
  $$$
}'

Length of output: 69


Script:

#!/bin/bash
# Let's first find the FeedbacksPrintView component file
fd "FeedbacksPrintView" --type f

# Then let's look for any interface or type definitions related to props
rg -A 10 "interface.*Props|type.*Props" $(fd "FeedbacksPrintView" --type f)

Length of output: 475

apps/frontend-manage/src/components/liveQuiz/EmbeddingModal.tsx (1)

77-77: 💡 Codebase verification

Translation key needs to be updated in translation files

The component is using manage.liveQuizzes.evaluationLinksEmbedding but the translation files only have evaluationLinksEmbedding without the proper namespace. This mismatch will cause the translation to fail.

  • packages/i18n/messages/en.ts: Key needs to be moved under manage.liveQuizzes namespace
  • packages/i18n/messages/de.ts: Key needs to be moved under manage.liveQuizzes namespace
🔗 Analysis chain

LGTM: Translation key updated

The modal title translation key has been updated to use the new terminology.

Let's verify the translation key exists:


The previous command had issues with file type recognition. Let's try a more comprehensive search to find translation-related files and check for the key.


I see the key exists but need to verify its exact path structure to ensure it matches what's being used in the component.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the new translation key in translation files
rg "manage\.liveQuizzes\.evaluationLinksEmbedding" --type json

Length of output: 159


Script:

#!/bin/bash
# Search for translation files and then look for the translation key
fd -e json -e yaml translations | xargs rg "evaluationLinksEmbedding"

# Also search for any i18n/locale files
fd -e json -e yaml -e ts locale i18n | xargs rg "evaluationLinksEmbedding"

Length of output: 900


Script:

#!/bin/bash
# Let's check the exact structure of the translation keys in the files
rg -A 1 -B 1 "evaluationLinksEmbedding" packages/i18n/messages/en.ts packages/i18n/messages/de.ts

Length of output: 1095

apps/frontend-manage/src/components/liveQuiz/cockpit/CancelLiveQuizModal.tsx (1)

22-31: ⚠️ Potential issue

Update navigation path to match new terminology.

The component navigates to '/sessions' after canceling the quiz, which is inconsistent with the new "live quiz" terminology.

- router.push('/sessions')
+ router.push('/live-quizzes')

Also applies to: 125-127

apps/frontend-control/src/components/liveQuizzes/LiveQuizLists.tsx (1)

40-40: ⚠️ Potential issue

Update route path to use consistent terminology.

The link path still uses "session" instead of "live-quiz" or "quiz".

-link={`/session/${quiz.id}`}
+link={`/live-quiz/${quiz.id}`}

Also, remove the duplicate key prop on line 76 as it's already provided in the parent div.

Also applies to: 76-76

apps/docs/docs/tutorials/microlearning.mdx (1)

58-58: ⚠️ Potential issue

Fix grammatical error in the creation step.

The sentence is grammatically incorrect.

-11. With a click on Create your first microlearning is prepared!
+11. With a click on Create, your first microlearning is prepared!
📝 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.

11. With a click on Create, your first microlearning is prepared!
apps/docs/docs/tutorials/live_quiz.mdx (1)

74-74: ⚠️ Potential issue

Fix typo in quiz start instructions.

There's a typo in the sentence: "stared" should be "started".

-Once the quiz is stared, there are the following steps to take:
+Once the quiz is started, there are the following steps to take:
📝 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.

Once the quiz is started, there are the following steps to take:
apps/frontend-control/src/pages/session/[id].tsx (1)

107-119: ⚠️ Potential issue

Fix unsafe optional chaining in data destructuring.

The current optional chaining usage could lead to a TypeError if quizData is undefined but controlLiveQuiz is accessed.

-const { id, name, course, blocks } = quizData?.controlLiveQuiz
+const { id, name, course, blocks } = quizData?.controlLiveQuiz ?? {}
📝 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.

  const { id, name, course, blocks } = quizData?.controlLiveQuiz ?? {}

  if (!blocks) {
    return (
      <Layout title={name}>
        <UserNotification
          type="warning"
          message={t('control.liveQuiz.containsNoQuestions')}
        />
      </Layout>
    )
  }
🧰 Tools
🪛 Biome

[error] 107-107: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)

cypress/cypress/e2e/F-live-quiz-workflow.cy.ts (1)

795-802: 🛠️ Refactor suggestion

Add test coverage for error scenarios.

The cleanup process is well-handled, but consider adding test cases for:

  • Network failures during quiz operations
  • Concurrent modifications
  • Invalid input handling
  • Session timeout scenarios
apps/docs/src/constants.tsx (2)

288-292: 🛠️ Refactor suggestion

Ensure consistent terminology: Replace 'sessions' with 'live quizzes'

In line 290, the term "sessions" is used. Since we are standardizing on "live quiz," consider replacing "sessions" with "live quizzes" for consistency.


490-490: 🛠️ Refactor suggestion

Update "sessions" to "live quizzes" for consistency

Consider replacing "sessions" with "live quizzes" to maintain consistent terminology throughout the document.

Copy link

sonarqubecloud bot commented Nov 6, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
15.3% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarCloud

Catch issues before they fail your Quality Gate with our IDE extension SonarLint

@sjschlapbach sjschlapbach merged commit 37f5a32 into v3-new-live-quiz Nov 6, 2024
15 of 16 checks passed
@sjschlapbach sjschlapbach deleted the cleanup-sessions-content branch November 6, 2024 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant