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

refactor: quiz template config #14208

Merged
merged 4 commits into from
Nov 18, 2024
Merged

refactor: quiz template config #14208

merged 4 commits into from
Nov 18, 2024

Conversation

wackerow
Copy link
Member

@wackerow wackerow commented Oct 21, 2024

Targers branch: rename-quiz-keys

Description

  • Refactors questionBank logic to use a simplified questionBankConfig object, which seeds the questionBank object needed for the front end

Example

Inside const questionBankConfig: QuestionBankConfig from src/data/quizzes/questionBank.ts:

  "some-quiz-topic": [
    { totalAnswers: 4, correctAnswer: 2 },
    { totalAnswers: 2, correctAnswer: 1 },
    { totalAnswers: 4, correctAnswer: 4 },
  ],

This will be parsed into the following before being exported as part of questionBank:

  "some-quiz-topic-1": {
    prompt: "some-quiz-topic-1-prompt",
    answers: [
      {
        id: "some-quiz-topic-1-a",
        label: "some-quiz-topic-1-a-label",
        explanation: "some-quiz-topic-1-a-explanation",
      },
      {
        id: "some-quiz-topic-1-b",
        label: "some-quiz-topic-1-b-label",
        explanation: "some-quiz-topic-1-b-explanation",
      },
      {
        id: "some-quiz-topic-1-c",
        label: "some-quiz-topic-1-c-label",
        explanation: "some-quiz-topic-1-c-explanation",
      },
      {
        id: "some-quiz-topic-1-d",
        label: "some-quiz-topic-1-d-label",
        explanation: "some-quiz-topic-1-d-explanation",
      },
    ],
    correctAnswerId: "some-quiz-topic-1-b",
  },
  "some-quiz-topic-2": {
    prompt: "some-quiz-topic-2-prompt",
    answers: [
      {
        id: "some-quiz-topic-2-a",
        label: "some-quiz-topic-2-a-label",
        explanation: "some-quiz-topic-2-a-explanation",
      },
      {
        id: "some-quiz-topic-2-b",
        label: "some-quiz-topic-2-b-label",
        explanation: "some-quiz-topic-2-b-explanation",
      },
    ],
    correctAnswerId: "some-quiz-topic-2-a",
  },
  "some-quiz-topic-3": {
    prompt: "some-quiz-topic-3-prompt",
    answers: [
      {
        id: "some-quiz-topic-3-a",
        label: "some-quiz-topic-3-a-label",
        explanation: "some-quiz-topic-3-a-explanation",
      },
      {
        id: "some-quiz-topic-3-b",
        label: "some-quiz-topic-3-b-label",
        explanation: "some-quiz-topic-3-b-explanation",
      },
      {
        id: "some-quiz-topic-3-c",
        label: "some-quiz-topic-3-c-label",
        explanation: "some-quiz-topic-3-c-explanation",
      },
      {
        id: "some-quiz-topic-3-d",
        label: "some-quiz-topic-3-d-label",
        explanation: "some-quiz-topic-3-d-explanation",
      },
    ],
    correctAnswerId: "some-quiz-topic-3-d",
  },

Separately, these strings must be added to the en/learn-quizzes.json file for each question:

  • some-quiz-topic-${questionNumberForTopic}-prompt
  • some-quiz-topic-${questionNumberForTopic}-${answerChoiceLetter}-label (for each answer choice)
  • some-quiz-topic-${questionNumberForTopic}-${answerChoiceLetter}-explanation (for each answer choice)

Related Issue

Ongoing Quiz improvement efforts

@github-actions github-actions bot added content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program labels Oct 21, 2024
Copy link

netlify bot commented Oct 21, 2024

Deploy Preview for ethereumorg ready!

Name Link
🔨 Latest commit 4744f61
🔍 Latest deploy log https://app.netlify.com/sites/ethereumorg/deploys/673b92f032ef4f00089a5b48
😎 Deploy Preview https://deploy-preview-14208--ethereumorg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
Lighthouse
Lighthouse
7 paths audited
Performance: 46 (🔴 down 8 from production)
Accessibility: 92 (no change from production)
Best Practices: 89 (🔴 down 9 from production)
SEO: 99 (no change from production)
PWA: -
View the detailed breakdown and full score reports

To edit notification comments on pull requests, go to your Netlify site configuration.

@wackerow wackerow changed the base branch from dev to rename-quiz-keys October 21, 2024 21:28
* - "what-is-ethereum-1-d-label"
* - "what-is-ethereum-1-d-explanation"
*/
const questionBankConfig: QuestionBankConfig = {
Copy link
Member Author

Choose a reason for hiding this comment

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

🚨 Start here for the core of proposed changes

@wackerow wackerow marked this pull request as ready for review October 21, 2024 21:31
"All of the options provide ways to own digital assets on Ethereum. Tokens, NFTs, and ENS are all ways to represent ownership of digital assets."
Base automatically changed from rename-quiz-keys to dev November 18, 2024 18:35
@corwintines corwintines self-assigned this Nov 18, 2024
@corwintines corwintines merged commit e2c1f62 into dev Nov 18, 2024
9 of 10 checks passed
@corwintines corwintines deleted the rn-quiz-keys--config-refactor branch November 18, 2024 20:12
This was referenced Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content 🖋️ This involves copy additions or edits tooling 🔧 Changes related to tooling of the project translation 🌍 This is related to our Translation Program
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants