pedago-angular-quiz
TypeScript icon, indicating that this package has built-in type declarations

0.0.3-beta • Public • Published

Pedago Angular Quiz

This library was generated with Angular CLI version 16.2.0.

Installing

npm install pedago-angular-quiz --save

Usage

Import NgxQuizModule

import { PedagoAngularQuizModule } from 'pedago-angular-quiz';

@NgModule({
  imports: [
    // Other module imports
    PedagoAngularQuizModule
  ],
  // Other module properties
})
export class YourModule { }

Usage

Use it in your template and then pass a data object to the component as follows as an example

<pedago-angular-quiz [data]="data" (onSubmit)="onSubmit($event)"></pedago-angular-quiz>

Configuration

Properties

Property Type Description
data! IData The quiz data
metadata? IMetadata The quiz configuration
client? string The client name
userId? string The connected user id

Emitters

Name Parameters Description
onSubmit event: IResult Callback to invoke on quiz submission

Interfaces

IData

Interface representing the data structure of the quiz:

interface IData {
questions: IQuestion[];
}

IQuestion

Interface representing a quiz question:

interface IQuestion {
  question: string;
  options: IOption[];
  explanation: string;
  skill: string;
}

IOption

Interface representing a question option:

interface IOption {
  option: string;
  is_correct: boolean;
}

IResult

Interface representing the result of the quiz:

interface IResult {
  client?: string;
  userId?: string;
  response: IResponse[];
}

IResponse

Interface representing the response to a quiz question:

interface IResponse {
  questionID: string;
  answer: string | string[];
  correctedAnswer: string | string[];
  is_correct: boolean;
  is_partially_correct?: boolean;
}

ITheme

Interface representing the theme of the quiz:

interface ITheme {
  primaryColor?: string;
  secondaryColor?: string;
  hasheader?: boolean;
  headerBackColor?: string;
  headerImage?: string;
}

Examples

const data = {
  "questions":
  [
    {
      "question": "Quelle est la règle de probabilité qui dit que la probabilité d'un événement complémentaire est égale à 1 moins la probabilité de cet événement ?",
      "options": [
        {
          "option": "La règle de l'addition",
          "is_correct": false
        },
        {
          "option": "La règle de la multiplication",
          "is_correct": false
        },
        {
          "option": "La règle du complément",
          "is_correct": true
        },
        {
          "option": "La règle de Bayes",
          "is_correct": false
        }
      ],
      "explanation": "La réponse correcte est la règle du complément. Cette règle indique que la probabilité de l'événement complémentaire est égale à 1 moins la probabilité de l'événement lui-même.",
      "skill": "Applying Probability Rules"
    },
    {
      "question": "Quelles sont les distributions de probabilité discrètes les plus couramment utilisées pour modéliser des phénomènes aléatoires dans le domaine des sciences et de l'ingénierie?",
      "options": [
        {
          "option": "Loi normale",
          "is_correct": false
        },
        {
          "option": "Loi uniforme",
          "is_correct": false
        },
        {
          "option": "Loi binomiale",
          "is_correct": true
        },
        {
          "option": "Loi exponentielle",
          "is_correct": true
        }
      ],
      "explanation": "Les lois binomiale et exponentielle sont des distributions de probabilité discrètes couramment utilisées pour modéliser des phénomènes aléatoires. La loi binomiale est utilisée pour des expériences aléatoires avec un nombre fixe d'essais indépendants, tandis que la loi exponentielle est utilisée pour modéliser le temps entre occurrences d'événements selon un processus de Poisson.",
      "skill": "Random Variables and Their Distributions"
    },
    {
      "question": "Quelle est la règle utilisée pour calculer la probabilité de l'intersection de deux événements indépendants?",
      "options": [
        {
          "option": "La règle de l'addition",
          "is_correct": false
        },
        {
          "option": "La règle de Bayes",
          "is_correct": false
        },
        {
          "option": "La règle de la multiplication",
          "is_correct": true
        },
        {
          "option": "La règle du complément",
          "is_correct": false
        }
      ],
      "explanation": "La réponse correcte est la règle de la multiplication. Cette règle stipule que la probabilité de l'intersection de deux événements indépendants est égale au produit de leurs probabilités individuelles.",
      "skill": "Applying Probability Rules"
    }
  ]
}

License

This project is licensed under the MIT License - see the LICENSE file for details.

Package Sidebar

Install

npm i pedago-angular-quiz

Weekly Downloads

15

Version

0.0.3-beta

License

none

Unpacked Size

102 kB

Total Files

20

Last publish

Collaborators

  • sofiene.ghb