<commit_before>define [
  'ember'
  'ember-data'
  './question_statistics/response_ratio_calculator'
], (Em, DS, ResponseRatioCalculator) ->

  {alias} = Em.computed
  {Model, attr, belongsTo} = DS

  Model.extend
    quizStatistics: belongsTo 'quiz_statistics', async: false
    questionType: attr()
    questionName: attr()
    questionText: attr()
    position: attr()
    answers: attr()
    pointBiserials: attr()
    responses: attr()
    responseValues: attr()
    unexpectedResponseValues: attr()

    # MC/TF stats
    topStudentCount: attr()
    middleStudentCount: attr()
    bottomStudentCount: attr()
    correctStudentCount: attr()
    incorrectStudentCount: attr()
    correctStudentRatio: attr()
    incorrectStudentRatio: attr()
    correctTopStudentCount: attr()
    correctMiddleStudentCount: attr()
    correctBottomStudentCount: attr()

    speedGraderUrl: alias('quizStatistics.quiz.speedGraderUrl').readOnly()
    quizSubmissionsZipUrl: alias('quizStatistics.quiz.quizSubmissionsZipUrl').readOnly()

    # Helper for calculating the ratio of correct responses for this question.
    #
    # Usage: @get('questionStatistics.ratioCalculator.ratio')
    ratioCalculator: (->
      ResponseRatioCalculator.create({ content: this })
    ).property('answers')

    answerSets: (->
      sets = @get('_data.answer_sets') || []
      sets.map (set) ->
        Em.Object.create(set)
    ).property('_data.answer_sets')

    # Essay stats
    fullCredit: attr()
    graded: attr()
    pointDistribution: attr()

    renderableType: (->
      switch @get('questionType')
        when 'multiple_choice_question', 'true_false_question'
          'multiple_choice'
        when 'short_answer_question', 'multiple_answers_question'
          'short_answer'
        when 'fill_in_multiple_blanks_question', 'multiple_dropdowns_question'
          'fill_in_multiple_blanks'
        when 'essay_question'
          'essay'
        when 'file_upload_question'
          'file_upload'
        when 'calculated_question'
          'calculated'
        else
          'generic'
    ).property('questionType')

    discriminationIndex: (->
      if pointBiserials = @get('pointBiserials')
        pointBiserials.findBy('correct', true).point_biserial<commit_msg>Ember Quiz Stats - Matching<commit_after>define [
  'ember'
  'ember-data'
  './question_statistics/response_ratio_calculator'
], (Em, DS, ResponseRatioCalculator) ->

  {alias} = Em.computed
  {Model, attr, belongsTo} = DS

  Model.extend
    quizStatistics: belongsTo 'quiz_statistics', async: false
    questionType: attr()
    questionName: attr()
    questionText: attr()
    position: attr()
    answers: attr()
    pointBiserials: attr()
    responses: attr()
    responseValues: attr()
    unexpectedResponseValues: attr()

    # MC/TF stats
    topStudentCount: attr()
    middleStudentCount: attr()
    bottomStudentCount: attr()
    correctStudentCount: attr()
    incorrectStudentCount: attr()
    correctStudentRatio: attr()
    incorrectStudentRatio: attr()
    correctTopStudentCount: attr()
    correctMiddleStudentCount: attr()
    correctBottomStudentCount: attr()

    speedGraderUrl: alias('quizStatistics.quiz.speedGraderUrl').readOnly()
    quizSubmissionsZipUrl: alias('quizStatistics.quiz.quizSubmissionsZipUrl').readOnly()

    # Helper for calculating the ratio of correct responses for this question.
    #
    # Usage: @get('questionStatistics.ratioCalculator.ratio')
    ratioCalculator: (->
      ResponseRatioCalculator.create({ content: this })
    ).property('answers')

    answerSets: (->
      sets = @get('_data.answer_sets') || []
      sets.map (set) ->
        Em.Object.create(set)
    ).property('_data.answer_sets')

    # Essay stats
    fullCredit: attr()
    graded: attr()
    pointDistribution: attr()

    renderableType: (->
      switch @get('questionType')
        when 'multiple_choice_question', 'true_false_question'
          'multiple_choice'
        when 'short_answer_question', 'multiple_answers_question'
          'short_answer'
        when 'fill_in_multiple_blanks_question', 'multiple_dropdowns_question', 'matching_question'
          'fill_in_multiple_blanks'
        when 'essay_question'
          'essay'
        when 'file_upload_question'
          'file_upload'
        when 'calculated_question'
          'calculated'
        else
          'generic'
    ).property('questionType')

    discriminationIndex: (->
      if pointBiserials = @get('pointBiserials')
        pointBiserials.findBy('correct', true).point_biserial
{'fraction_non_alphanumeric': 0.11142794472472034, 'fraction_numerical': 0.0, 'mean_word_length': 3.3387250237868695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5831395', 'n_tokens_mistral': 1373, 'n_tokens_neox': 1334, 'n_words': 261}