app/controllers/campaigns_controller.rb
def serialize_campaign_meta(campaign)
      {
        milestones: campaign
                      .milestones
                      .order(estimates_at: :desc)
                      .map { |milestone| serialize_campaign_milestone(milestone) },
        total_invited_count: campaign.contributors.where.not(referrer: nil).count,
        early_bird_until: campaign.early_bird_until,
        estimate_first_releasing_in: campaign.estimate_first_releasing_in,
        estimate_end_releasing_in: campaign.estimate_end_releasing_in,
        first_releasing_percentage: campaign.first_releasing_percentage,
        estimate_releasing_days_interval: campaign.estimate_releasing_days_interval,
        estimate_releasing_percentage_per_interval: ((100 - campaign.first_releasing_percentage).to_d / (campaign.estimate_end_releasing_in - campaign.estimate_first_releasing_in).to_i * campaign.estimate_releasing_days_interval).to_f.truncate(4),
        contribution_chart: campaign.hourly_contributions.order(timestamp: :asc).limit(CHART_POINTS_LIMIT).pluck(:timestamp, :amount).map { |i| [i[0], i[1].to_f.truncate(4)] }
      }
    end
# Hourly by default with 14 days
Hourly by default with 14 days
Hourly by default with 14 days
def serialize_campaign_meta(campaign)
      {
        milestones: campaign
                      .milestones
                      .order(estimates_at: :desc)
                      .map { |milestone| serialize_campaign_milestone(milestone) },
        total_invited_count: campaign.contributors.where.not(referrer: nil).count,
        early_bird_until: campaign.early_bird_until,
        estimate_first_releasing_in: campaign.estimate_first_releasing_in,
        estimate_end_releasing_in: campaign.estimate_end_releasing_in,
        first_releasing_percentage: campaign.first_releasing_percentage,
        estimate_releasing_days_interval: campaign.estimate_releasing_days_interval,
        estimate_releasing_percentage_per_interval: ((100 - campaign.first_releasing_percentage).to_d / (campaign.estimate_end_releasing_in - campaign.estimate_first_releasing_in).to_i * campaign.estimate_releasing_days_interval).to_f.truncate(4),
        contribution_chart: campaign.hourly_contributions.order(timestamp: :asc).limit(CHART_POINTS_LIMIT).pluck(:timestamp, :amount).map { |i| [i[0], i[1].to_f.truncate(4)] }
      }
    end
def serialize_campaign_meta ( campaign ) { milestones : campaign . milestones . order ( estimates_at : :desc ) . map { | milestone | serialize_campaign_milestone ( milestone ) } , total_invited_count : campaign . contributors . where . not ( referrer : nil ) . count , early_bird_until : campaign . early_bird_until , estimate_first_releasing_in : campaign . estimate_first_releasing_in , estimate_end_releasing_in : campaign . estimate_end_releasing_in , first_releasing_percentage : campaign . first_releasing_percentage , estimate_releasing_days_interval : campaign . estimate_releasing_days_interval , estimate_releasing_percentage_per_interval : ( ( 100 - campaign . first_releasing_percentage ) . to_d / ( campaign . estimate_end_releasing_in - campaign . estimate_first_releasing_in ) . to_i * campaign . estimate_releasing_days_interval ) . to_f . truncate ( 4 ) , contribution_chart : campaign . hourly_contributions . order ( timestamp : :asc ) . limit ( CHART_POINTS_LIMIT ) . pluck ( :timestamp , :amount ) . map { | i | [ i [ 0 ] , i [ 1 ] . to_f . truncate ( 4 ) ] } } end
Hourly by default with 14 days
Hourly by default with 14 days
campaign