small updates
This commit is contained in:
parent
ad4aa7a1b9
commit
fb893ed4c3
@ -74,9 +74,9 @@ class KapsDay < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def total_points
|
||||
self.kapsmes.sum(:point_to_count)
|
||||
before_validation do
|
||||
self.total_points = self.kapsmes.sum(:point_to_count)
|
||||
self.points = self.total_points_earneds
|
||||
end
|
||||
|
||||
def total_points_earneds
|
||||
@ -85,7 +85,7 @@ class KapsDay < ActiveRecord::Base
|
||||
|
||||
|
||||
def completed
|
||||
(100.0 * self.total_points_earneds.to_f) / total_points.to_f
|
||||
(100.0 * self.points.to_f) / total_points.to_f
|
||||
|
||||
end
|
||||
|
||||
|
@ -30,6 +30,10 @@ class Kapsme < ActiveRecord::Base
|
||||
|
||||
end
|
||||
|
||||
after_save do
|
||||
self.kaps_day.save
|
||||
end
|
||||
|
||||
def generate_token
|
||||
|
||||
begin
|
||||
|
@ -1,6 +1,12 @@
|
||||
%tr#kaps_day{:id => kaps_day.id}
|
||||
%td= link_to l(kaps_day.date), [:public, kaps_day]
|
||||
|
||||
%td= kaps_day.total_points
|
||||
%td= kaps_day.points
|
||||
|
||||
%td
|
||||
#pourcentage_inner
|
||||
=render(:partial => "pourcentage", :locals => {:kaps_day => kaps_day})
|
||||
|
||||
|
||||
|
||||
|
@ -9,7 +9,17 @@
|
||||
|
||||
-KapsRappel.generate_rappels
|
||||
|
||||
|
||||
|
||||
-prev_day = @kaps_day.p_customer.kaps_days.order("date DESC").where("date < ?", @kaps_day.date).first
|
||||
-if prev_day
|
||||
=link_to "< Jour précédent", public_kaps_day_path(prev_day)
|
||||
|
||||
|
||||
-next_day = @kaps_day.p_customer.kaps_days.order("date ASC").where("date > ?", @kaps_day.date).first
|
||||
-if next_day
|
||||
=link_to "Jour suivant >", public_kaps_day_path(next_day)
|
||||
|
||||
|
||||
.qi_row
|
||||
.qi_pannel.qi_plain.padding{:style => "position:relative;"}
|
||||
#pourcentage_inner{:style => "position:absolute;top:0;left:0;right:0;"}
|
||||
|
Loading…
x
Reference in New Issue
Block a user