FogBugz #63: Geburtstagsliste fr 'next 7 days' erstellen.
This commit is contained in:
parent
34c4b6d9b1
commit
eee201d0cd
2 changed files with 17 additions and 3 deletions
|
|
@ -1,6 +1,15 @@
|
|||
class BirthdayController < ApplicationController
|
||||
def index
|
||||
# start_date =
|
||||
@birthdays = Contact.where(:birth_date => (Date.today)..(Date.today + 7.days))
|
||||
n = Date.today
|
||||
e = Date.today + 7.days
|
||||
|
||||
# two cases here: now + 7days iis still the same month. or it's not.
|
||||
if n.month == e.month
|
||||
@birthdays = Contact.where("birth_month = ? AND birth_day <= ? AND birth_day >= ?",
|
||||
e.month, e.day, n.day)
|
||||
else
|
||||
@birthdays = Contact.where("(birth_month = ? AND birth_day <= ?) OR (birth_month = ? AND birth_day >= ?)",
|
||||
e.month, e.day, n.month, n.day)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
|
||||
<% @birthdays.each do |b| %>
|
||||
<div class="row">
|
||||
|
||||
<div class="onecol">
|
||||
<%= b.birth_date_string %>
|
||||
</div>
|
||||
<div class="tencol">
|
||||
<strong><%= b.firstname + " " + b.lastname %></strong>
|
||||
</div>
|
||||
</row>
|
||||
<% end %>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue