<commit_before># Allows good and bad things to be added to Hubot for sprint retrospective
#  Based on tasks.coffee
#
# good <good thing> - Add something good that happened this sprint
# bad <bad thing> - Add something bad that happened this sprint
# goodlist - List all good things that happened
# badlist - List all bad things that happened
# gooddel - Delete all good things that happened
# baddel - Delete all bad things that happened

class GoodBad
  constructor: (@robot) ->
    @goodcache = []
    @badcache = []
    @robot.brain.on 'loaded', =>
      if @robot.brain.data.good
        @goodcache = @robot.brain.data.good
      if @robot.brain.data.bad
        @badcache = @robot.brain.data.bad

  nextGoodNum: ->
    maxGoodNum = if @goodcache.length then Math.max.apply(Math,@goodcache.map (n) -> n.num) else 0
    maxGoodNum++
    maxGoodNum
  nextBadNum: ->
    maxBadNum = if @badcache.length then Math.max.apply(Math,@badcache.map (n) -> n.num) else 0
    maxBadNum++
    maxBadNum  
  goodlist: -> @goodcache
  badlist: -> @badcache
  good: (goodString) ->
    goodthing = {num: @nextGoodNum(), good: goodString}
    @goodcache.push goodthing
    @robot.brain.data.good = @goodcache
    goodthing
  bad: (badString) ->
    badthing = {num: @nextBadNum(), bad: badString}
    @badcache.push badthing
    @robot.brain.data.bad = @badcache
    badthing
  gooddel: ->
    good = @goodcache = []
    good 
  baddel: ->
    bad = @badcache = []
    bad

module.exports = (robot) ->
  goodbad = new GoodBad robot
  
  robot.respond /(good) (.+?)$/i, (msg) ->
    good = goodbad.good msg.match[2]<commit_msg>Fix delete.<commit_after># Allows good and bad things to be added to Hubot for sprint retrospective
#  Based on tasks.coffee
#
# good <good thing> - Add something good that happened this sprint
# bad <bad thing> - Add something bad that happened this sprint
# goodlist - List all good things that happened
# badlist - List all bad things that happened
# gooddel - Delete all good things that happened
# baddel - Delete all bad things that happened

class GoodBad
  constructor: (@robot) ->
    @goodcache = []
    @badcache = []
    @robot.brain.on 'loaded', =>
      if @robot.brain.data.good
        @goodcache = @robot.brain.data.good
      if @robot.brain.data.bad
        @badcache = @robot.brain.data.bad

  nextGoodNum: ->
    maxGoodNum = if @goodcache.length then Math.max.apply(Math,@goodcache.map (n) -> n.num) else 0
    maxGoodNum++
    maxGoodNum
  nextBadNum: ->
    maxBadNum = if @badcache.length then Math.max.apply(Math,@badcache.map (n) -> n.num) else 0
    maxBadNum++
    maxBadNum  
  goodlist: -> @goodcache
  badlist: -> @badcache
  good: (goodString) ->
    goodthing = {num: @nextGoodNum(), good: goodString}
    @goodcache.push goodthing
    @robot.brain.data.good = @goodcache
    goodthing
  bad: (badString) ->
    badthing = {num: @nextBadNum(), bad: badString}
    @badcache.push badthing
    @robot.brain.data.bad = @badcache
    badthing
  gooddel: ->
    @goodcache = []
    @robot.brain.data.good = @goodcache
  baddel: ->
    @badcache = []
    @robot.brain.data.bad = @badcache

module.exports = (robot) ->
  goodbad = new GoodBad robot
  
  robot.respond /(good) (.+?)$/i, (msg) ->
    good = goodbad.good msg.match[2]
{'fraction_non_alphanumeric': 0.12626108223784777, 'fraction_numerical': 0.0018343014368694588, 'mean_word_length': 2.9612590799031477, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 35, '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': '4249768', 'n_tokens_mistral': 1122, 'n_tokens_neox': 1092, 'n_words': 308}