<commit_before>Template.notificationBadge.helpers({
  count: function () {
    // TODO: find a better way ?
    this._count = this._count || this.count;

    if (this.count !== this._count) {
      $('.notification-count')
        .css({ opacity: 0 })
        .css({ top: '-3px' })
        .animate({ top: '5px', opacity: 1 });  
    }

    return this.count;
  }
});<commit_msg>Fix animation and count checking<commit_after>Template.notificationBadge.helpers({
  count: function () {
    // access template instance instead of 'this', 
    // which only returns the data context
    var self = Template.instance();

    self._count = self._count || this.count;

    if (this.count !== self._count) {
      Meteor.defer(function () {
        $('.notification-count')
          .css({ opacity: 0 })
          .css({ top: '-20px' })
          .animate({ top: '-8px', opacity: 1 });    
      });
      
      self._count = this.count;
    }

    return this.count;
  }
});
{'fraction_non_alphanumeric': 0.16597938144329896, 'fraction_numerical': 0.009278350515463918, 'mean_word_length': 2.183606557377049, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2068070', 'n_tokens_mistral': 303, 'n_tokens_neox': 290, 'n_words': 73}