<commit_before>class window.FactRelationVoteView extends Backbone.Marionette.ItemView

  className: 'vote-up-down'

  initialize: ->
    @listenTo @model, "change", @render
    @listenTo @model.getFact().getFactWheel(), "change", @render

  set_fact_relation_opinion: (opinion) ->
    is_current_opinion = @model.current_opinion() == opinion
    unless is_current_opinion
      @_originalFactRelationOpinion = @model.current_opinion()
      @model.setOpinion opinion

  unset_fact_relation_opinion: (opinion) ->
    is_current_opinion = @model.current_opinion() == opinion
    if is_current_opinion
      if @_originalFactRelationOpinion?
        @model.setOpinion @_originalFactRelationOpinion
        @_originalFactRelationOpinion = null
      else
        @model.removeOpinion()

  set_fact_opinion: (opinion) ->
    is_current_opinion = @model.getFact().getFactWheel().isUserOpinion opinion

    unless is_current_opinion
      @_originalFactOpinion = @model.getFact().getFactWheel().userOpinion()
      @_set_fact_opinion opinion

  unset_fact_opinion: (opinion) ->
    is_current_opinion = @model.getFact().getFactWheel().isUserOpinion opinion
    if is_current_opinion
      if @_originalFactOpinion?
        @_set_fact_opinion @_originalFactOpinion
        @_originalFactOpinion = null
      else
        @_unset_fact_opinion opinion

  _set_fact_opinion: (opinion) ->
    @model.getFact().getFactWheel().setActiveOpinionType opinion

  _unset_fact_opinion: (opinion) ->
    @model.getFact().getFactWheel().unsetActiveOpinionType opinion<commit_msg>Inlined two methods<commit_after>class window.FactRelationVoteView extends Backbone.Marionette.ItemView

  className: 'vote-up-down'

  initialize: ->
    @listenTo @model, "change", @render
    @listenTo @model.getFact().getFactWheel(), "change", @render

  set_fact_relation_opinion: (opinion) ->
    is_current_opinion = @model.current_opinion() == opinion
    unless is_current_opinion
      @_originalFactRelationOpinion = @model.current_opinion()
      @model.setOpinion opinion

  unset_fact_relation_opinion: (opinion) ->
    is_current_opinion = @model.current_opinion() == opinion
    if is_current_opinion
      if @_originalFactRelationOpinion?
        @model.setOpinion @_originalFactRelationOpinion
        @_originalFactRelationOpinion = null
      else
        @model.removeOpinion()

  set_fact_opinion: (opinion) ->
    is_current_opinion = @model.getFact().getFactWheel().isUserOpinion opinion

    unless is_current_opinion
      @_originalFactOpinion = @model.getFact().getFactWheel().userOpinion()
      @model.getFact().getFactWheel().setActiveOpinionType opinion

  unset_fact_opinion: (opinion) ->
    is_current_opinion = @model.getFact().getFactWheel().isUserOpinion opinion
    if is_current_opinion
      if @_originalFactOpinion?
        @model.getFact().getFactWheel().setActiveOpinionType @_originalFactOpinion
        @_originalFactOpinion = null
      else
        @model.getFact().getFactWheel().unsetActiveOpinionType opinion
{'fraction_non_alphanumeric': 0.09840954274353876, 'fraction_numerical': 0.0, 'mean_word_length': 4.277972027972028, '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': '4819826', 'n_tokens_mistral': 1046, 'n_tokens_neox': 910, 'n_words': 145}