<commit_before>React      = require 'react'
BS         = require 'react-bootstrap'
Time       = require '../time'
classnames = require 'classnames'

{ScoresActions} = require '../../flux/scores'

TH = require '../../helpers/task'

class LateWork
  constructor: (@task) ->
    @isAccepted = @task.is_late_work_accepted
    @status = if @isAccepted
      if TH.hasAdditionalLateWork(@task) then 'additional' else 'accepted'
    else
      'pending'

  score: ->
    if @state is 'accepted'
      TH.getHumanUnacceptedScore(@task)
    else
      TH.getHumanScoreWithLateWork(@task)

  lateExerciseCount: ->
    @task.completed_exercise_count - @task.completed_on_time_exercise_count

  lateDueDate: ->
    if @state is 'accepted'
      'the due date'
    else
      <Time date={@task.last_worked_at} format='shortest' />

  className: ->
    classnames( 'late-work-info-popover', @keyword, @status, {
      'is-accepted': @isAccepted
    })

  get: (type) ->
    @[type]()?[@status] or ''

class HomeworkContent extends LateWork

  reportingOn:  'Score'
  title: ->
    additional: "Additional late work"
    accepted:   "You accepted this student's late score."
    pending:    "#{@lateExerciseCount()} questions worked after the due date"
  button: ->
    additional: 'Accept new late score'
    accepted:   'Use this score'
    pending:    'Accept late score'
  body: ->
    additional:
      <div className="body">
        This student worked {TH.lateStepCount(@task)} questions
        after you accepted a late score
        on <Time date={@task.accepted_late_at} format='shortest' />
      </div>


class ReadingContent extends LateWork

  reportingOn:  'Progress'
  title: -><commit_msg>remove `the`, add `.`<commit_after>React      = require 'react'
BS         = require 'react-bootstrap'
Time       = require '../time'
classnames = require 'classnames'

{ScoresActions} = require '../../flux/scores'

TH = require '../../helpers/task'

class LateWork
  constructor: (@task) ->
    @isAccepted = @task.is_late_work_accepted
    @status = if @isAccepted
      if TH.hasAdditionalLateWork(@task) then 'additional' else 'accepted'
    else
      'pending'

  score: ->
    if @state is 'accepted'
      TH.getHumanUnacceptedScore(@task)
    else
      TH.getHumanScoreWithLateWork(@task)

  lateExerciseCount: ->
    @task.completed_exercise_count - @task.completed_on_time_exercise_count

  lateDueDate: ->
    if @state is 'accepted'
      'due date'
    else
      <Time date={@task.last_worked_at} format='shortest' />

  className: ->
    classnames( 'late-work-info-popover', @keyword, @status, {
      'is-accepted': @isAccepted
    })

  get: (type) ->
    @[type]()?[@status] or ''

class HomeworkContent extends LateWork

  reportingOn:  'Score'
  title: ->
    additional: "Additional late work"
    accepted:   "You accepted this student's late score."
    pending:    "#{@lateExerciseCount()} questions worked after the due date"
  button: ->
    additional: 'Accept new late score'
    accepted:   'Use this score'
    pending:    'Accept late score'
  body: ->
    additional:
      <div className="body">
        This student worked {TH.lateStepCount(@task)} questions
        after you accepted a late score
        on <Time date={@task.accepted_late_at} format='shortest' />.
      </div>


class ReadingContent extends LateWork

  reportingOn:  'Progress'
  title: ->
{'fraction_non_alphanumeric': 0.12776630274417233, 'fraction_numerical': 0.0, 'mean_word_length': 2.983548766157462, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 31, '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': '957797', 'n_tokens_mistral': 1084, 'n_tokens_neox': 1047, 'n_words': 274}