|
|
|
@ -38,8 +38,10 @@ module CompetitionsHelper
|
|
|
|
|
def chart_stages competition
|
|
|
|
|
stages = []
|
|
|
|
|
statistic_stages = competition.competition_stages.where("score_rate > 0")
|
|
|
|
|
if competition.max_stage_end_time && competition.max_stage_end_time < Time.now && statistic_stages.size > 1
|
|
|
|
|
stages << {id: nil, name: "总排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time}
|
|
|
|
|
|
|
|
|
|
end_time = competition.max_stage_end_time || competition.end_time
|
|
|
|
|
if end_time && end_time < Time.now
|
|
|
|
|
stages << {id: nil, name: statistic_stages.size > 1 ? "总排行榜" : "排行榜", rate: 1.0, start_time: competition.start_time, end_time: competition.end_time}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
statistic_stages.each do |stage|
|
|
|
|
|