<commit_before>#= require './evidence'

class window.Comment extends Evidence

  defaults:
    evidence_type: 'Comment'
    current_user_opinion: "believes"
    sub_comments_count: 0

  validate: (attributes) ->
    'Content should not be empty' unless /^.*\S.*$/m.test(attributes.content)

  templateHelpers: =>
    creator: @creator

  creator: -> new User(@get('created_by'))

  can_destroy: -> @get 'can_destroy?'

  setOpinion: (type) ->
    @previous_user_opinion = @get('current_user_opinion')

    @save opinion: type

  believe: -> @setOpinion 'believes'
  disbelieve: -> @setOpinion 'disbelieves'

  current_opinion: -> @get('current_user_opinion')
  isBelieving: -> @get('current_user_opinion') == 'believes'
  isDisBelieving: -> @get('current_user_opinion') == 'disbelieves'

  removeOpinion: -> @unset('opinion'); @save()

  urlRoot: -> @collection.commentsUrl()

  argumentVotes: -> new ArgumentVotes {}, urlRoot: '' # TODO: implement
<commit_msg>Implemented ArgumentVotes in Comment model<commit_after>#= require './evidence'

class window.Comment extends Evidence

  defaults:
    evidence_type: 'Comment'
    current_user_opinion: "believes"
    sub_comments_count: 0

  validate: (attributes) ->
    'Content should not be empty' unless /^.*\S.*$/m.test(attributes.content)

  templateHelpers: =>
    creator: @creator

  creator: -> new User(@get('created_by'))

  can_destroy: -> @get 'can_destroy?'

  urlRoot: -> @collection.commentsUrl()

  argumentVotes: ->
    @_argumentVotes ?= new ArgumentVotes @get('argument_votes'),
      urlRoot: @url()

{'fraction_non_alphanumeric': 0.14722753346080306, 'fraction_numerical': 0.0012746972594008922, 'mean_word_length': 4.304054054054054, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 22, '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': '5511860', 'n_tokens_mistral': 547, 'n_tokens_neox': 496, 'n_words': 109}