File

src/app/modules/sourcing/class/McqForm.ts

Properties

answer
answer: string
Type : string
bloomsLevel
bloomsLevel: string
Type : string
learningOutcome
learningOutcome: string
Type : string
maxScore
maxScore: number
Type : number
options
options: McqOptions[]
Type : McqOptions[]
question
question: string
Type : string
import * as _ from 'lodash-es';

export class McqOptions {
  constructor(public body: string) {
  }
}
export interface McqData {
  question: string;
  options: Array<McqOptions>;
  answer?: string;
  learningOutcome?: string;
  bloomsLevel?: string;
  maxScore?: number;
}
export interface McqConfig {
  templateId?: string;
  numberOfOptions?: number;
}

export class McqForm {
  public question: string;
  public options: Array<McqOptions>;
  public templateId: string;
  public answer: string;
  public learningOutcome;
  public bloomsLevel;
  public maxScore;
  public numberOfOptions;
  constructor({question, options, answer, learningOutcome, bloomsLevel, maxScore}: McqData, {templateId, numberOfOptions}: McqConfig) {
    this.question = question;
    this.options = options || [];
    this.templateId = templateId;
    this.answer = answer;
    this.learningOutcome = learningOutcome;
    this.bloomsLevel = bloomsLevel;
    this.maxScore = maxScore;
    this.numberOfOptions = numberOfOptions || 2;
    if (!this.options || !this.options.length) {
      _.times(this.numberOfOptions, index => this.options.push(new McqOptions('')));
    }
  }
  addOptions() {
    this.options.push(new McqOptions(''));
  }
  deleteOption(position) {
    this.options.splice(position, 1);
  }

}

results matching ""

    No results matching ""