0.0.3-beta • Published 1 year ago

pedago-angular-quiz v0.0.3-beta

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

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

PropertyTypeDescription
data!IDataThe quiz data
metadata?IMetadataThe quiz configuration
client?stringThe client name
userId?stringThe connected user id

Emitters

NameParametersDescription
onSubmitevent: IResultCallback 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.