<commit_before>setTitle = () ->
  pending = $('table#pending_estimate tr').size() - 1
  pending = 0 if pending < 0
  if pending > 0
    $(document).prop('title', "(#{pending}) Zenkai")
  else
    $(document).prop('title', "Zenkai")

  if pending > 9
    $('head').append($('<link rel="icon" type="image/ico" href="favicon9+.ico"/>'))
  else
    $('head').append($("<link rel='icon' type='image/ico' href='favicon#{pending}.ico'/>"))


$ ->
  $(document).on 'ajax:success', '.best_in_place', ()->
    $table = $(this).closest('table')
    refreshTable $table

  $(document).on 'ajax:success', '.restimate', ()->
    $table = $(this).closest('table')
    refreshTable $table

  refreshTable = ($table) ->
    if $table.data('path')
      $.get $table.data('path'), (data)->
        $table.replaceWith data
        $('.best_in_place').best_in_place()
    setTitle()

  setInterval () ->
    refreshTable $('table#pending_estimate')
    refreshTable $('table#pending')
  , 300000

  setTitle()<commit_msg>Invoke setTitle after refresh is complete<commit_after>setTitle = () ->
  pending = $('table#pending_estimate tr').size() - 1
  pending = 0 if pending < 0
  if pending > 0
    $(document).prop('title', "(#{pending}) Zenkai")
  else
    $(document).prop('title', "Zenkai")

  if pending > 9
    $('head').append($('<link rel="icon" type="image/ico" href="favicon9+.ico"/>'))
  else
    $('head').append($("<link rel='icon' type='image/ico' href='favicon#{pending}.ico'/>"))


$ ->
  $(document).on 'ajax:success', '.best_in_place', ()->
    $table = $(this).closest('table')
    refreshTable $table

  $(document).on 'ajax:success', '.restimate', ()->
    $table = $(this).closest('table')
    refreshTable $table

  refreshTable = ($table) ->
    if $table.data('path')
      $.get $table.data('path'), (data)->
        $table.replaceWith data
        $('.best_in_place').best_in_place()
        setTitle()

  setInterval () ->
    refreshTable $('table#pending_estimate')
    refreshTable $('table#pending')
  , 300000

  setTitle()
{'fraction_non_alphanumeric': 0.2182890855457227, 'fraction_numerical': 0.011799410029498525, 'mean_word_length': 3.646118721461187, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, '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': '4324062', 'n_tokens_mistral': 705, 'n_tokens_neox': 664, 'n_words': 130}