 class Langtrainer.LangtrainerApp.Models.Step extends Backbone.Model
+  initialize: ->
+    @resetState()
+
+  resetState: ->
+    @wordsHelped = 0
+    @stepsHelped = 0
+
+  difficultyIndex: (answer) ->
+    wordsNumber = answer.split(' ').length
+    if wordsNumber == 0
+      return 1
+
+    return @stepsHelped + @wordsHelped/wordsNumber
+
   baseParams: ->
     result = '?token=' + Langtrainer.LangtrainerApp.currentUser.readAttribute('token')
     result += '&unit=' + Langtrainer.LangtrainerApp.world.get('unit').get('id')

    result = Langtrainer.LangtrainerApp.apiEndpoint + '/verify_answer'
    result += @baseParams()
    result += '&answer=' + answer

  nextStepUrl: ->
    result = Langtrainer.LangtrainerApp.apiEndpoint + '/next_step'

      url: @nextStepUrl()
      dataType: 'json'
      success: (response) ->
        that.resetState()
        that.set response
        Langtrainer.LangtrainerApp.world.get('step').set response
        that.trigger('change', that)
