<commit_before>module Proposals
  module MustacheHelper
    def proposal_for_mustache(proposal)
      ret = {
        mustache: {
          now: (l Time.now),
          proposal: {
            good_score: (proposal.quorum.good_score),
            'voted?' => proposal.voted?,
            'voting_or_voted?' => proposal.voting? || proposal.voted?,
            rank: proposal.rank,
            percentage: proposal.percentage,
            'show_rank_bar?' => (proposal.percentage >= 1),
            'show_current_cursor?' => (proposal.percentage <= 98),
          },
          texts: {
            rank_bar: {
              creation: t('pages.proposals.new_rank_bar.creation', time_ago: time_ago_in_words(proposal.created_at).upcase, date: (l proposal.created_at, format: :long).upcase),
              end: t('pages.proposals.new_rank_bar.end', date: proposal.quorum.end_desc.upcase),
              now: t('pages.proposals.new_rank_bar.now', left: proposal.quorum.time_left).upcase,
              good_score: t('pages.proposals.new_rank_bar.good_score', score: proposal.quorum.good_score)
            }
          }
        }
      }
      if proposal.voting? || proposal.voted?
        ret[:mustache][:texts][:vote_bar]= {
          start: "INIZIO VOTAZIONE:<br/>#{(l proposal.vote_period.starttime).upcase}",
          end: "TERMINE VOTAZIONE:<br/>#{proposal.vote_period.endtime}".upcase
        }
        ret[:mustache][:proposal][:vote_percentage] = [((Time.now - proposal.vote_period.starttime)/proposal.vote_period.duration.to_f)*100, 100].min
        ret[:mustache][:proposal][:voters_percentage] = (proposal.user_votes_count.to_f/proposal.eligible_voters_count.to_f)*100
      end
      ret
    end

    def proposal_list_element_for_mustache(proposal)
      ret = proposal_for_mustache(proposal)
      ret[:mustahce][:proposal].merge!(id: proposal.id,<commit_msg>fix typo<commit_after>module Proposals
  module MustacheHelper
    def proposal_for_mustache(proposal)
      ret = {
        mustache: {
          now: (l Time.now),
          proposal: {
            good_score: (proposal.quorum.good_score),
            'voted?' => proposal.voted?,
            'voting_or_voted?' => proposal.voting? || proposal.voted?,
            rank: proposal.rank,
            percentage: proposal.percentage,
            'show_rank_bar?' => (proposal.percentage >= 1),
            'show_current_cursor?' => (proposal.percentage <= 98),
          },
          texts: {
            rank_bar: {
              creation: t('pages.proposals.new_rank_bar.creation', time_ago: time_ago_in_words(proposal.created_at).upcase, date: (l proposal.created_at, format: :long).upcase),
              end: t('pages.proposals.new_rank_bar.end', date: proposal.quorum.end_desc.upcase),
              now: t('pages.proposals.new_rank_bar.now', left: proposal.quorum.time_left).upcase,
              good_score: t('pages.proposals.new_rank_bar.good_score', score: proposal.quorum.good_score)
            }
          }
        }
      }
      if proposal.voting? || proposal.voted?
        ret[:mustache][:texts][:vote_bar]= {
          start: "INIZIO VOTAZIONE:<br/>#{(l proposal.vote_period.starttime).upcase}",
          end: "TERMINE VOTAZIONE:<br/>#{proposal.vote_period.endtime}".upcase
        }
        ret[:mustache][:proposal][:vote_percentage] = [((Time.now - proposal.vote_period.starttime)/proposal.vote_period.duration.to_f)*100, 100].min
        ret[:mustache][:proposal][:voters_percentage] = (proposal.user_votes_count.to_f/proposal.eligible_voters_count.to_f)*100
      end
      ret
    end

    def proposal_list_element_for_mustache(proposal)
      ret = proposal_for_mustache(proposal)
      ret[:mustache][:proposal].merge!(id: proposal.id,
{'fraction_non_alphanumeric': 0.1355478167693544, 'fraction_numerical': 0.006429145459416019, 'mean_word_length': 2.7191235059760954, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '7378105', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1235, 'n_words': 156}