FIxed issue in last commit: supports controller were not correctly filling the holes without data. Fixed duplication in supports and successful supports controller using a concer. Successfull supports controller will fill the holes without data in the same way that supports controller does.
25 lines
599 B
Ruby
25 lines
599 B
Ruby
class Dashboard::SupportsController < Dashboard::BaseController
|
|
include Dashboard::ExpectsDateRange
|
|
include Dashboard::GroupSupports
|
|
|
|
def index
|
|
authorize! :dashboard, proposal
|
|
render json: accumulated_supports
|
|
end
|
|
|
|
private
|
|
|
|
def accumulated_supports
|
|
grouped_votes = grouped_supports(:created_at)
|
|
accumulate_supports(grouped_votes)
|
|
fill_holes(grouped_votes)
|
|
end
|
|
|
|
|
|
def supports
|
|
@supports ||= Vote
|
|
.where(votable: proposal, created_at: start_date.beginning_of_day..end_date.end_of_day)
|
|
.order(created_at: :asc)
|
|
end
|
|
end
|