From Benjamin.LAN-SUN-LUK at supinfo.com Thu Aug 20 09:53:48 2015 Content-Type: multipart/mixed; boundary="===============2564627102904632635==" MIME-Version: 1.0 From: LAN-SUN-LUK Benjamin To: projxp-devel at lists.fedorahosted.org Subject: Re: [PROJXP] [PATCH] Add option to send daily updates to the product list. #65 Date: Sun, 30 Nov 2008 17:05:04 +0100 Message-ID: <59C8A761-F4FA-442D-83F8-F00637B319DD@supinfo.com> In-Reply-To: 1227707055-1087-1-git-send-email-mcpierce@gmail.com --===============2564627102904632635== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable NAK - The application raise on line 70 of schedules.rb. Because = tasks_performed[user] are nil. I think we must verify if the user are = present in the hash before do the each method on it. --- Benjamin LAN-SUN-LUK Le 26 nov. 08 =C3=A0 14:44, "Darryl L. Pierce" a = =C3=A9crit : > Added a new column to the notifications table to toggle sending > the notifications. > > Updated the user's profile page to include an option to toggle this > on and off. Also changed the notifications view to be more intuitive. > > When daily updates are collected, then all affected products are CC'd > with the user's daily update. CC'ing product lists requires the user > to have daily updates enabled. > > Signed-off-by: Darryl L. Pierce > --- > app/models/user_mailer.rb | 3 +- > app/views/users/_notifications.html.erb | 27 +++++++++++ = > +--- > config/initializers/schedules.rb | 33 +++++++++++ = > ++------ > .../022_add_send_notifications_to_product_list.rb | 26 +++++++++++ = > ++++ > db/schema.rb | 3 +- > 5 files changed, 73 insertions(+), 19 deletions(-) > create mode 100644 db/migrate/ = > 022_add_send_notifications_to_product_list.rb > > diff --git a/app/models/user_mailer.rb b/app/models/user_mailer.rb > index e830463..5609dc8 100644 > --- a/app/models/user_mailer.rb > +++ b/app/models/user_mailer.rb > @@ -58,8 +58,9 @@ class UserMailer < ActionMailer::Base > end > > # Sends an email to a user letting him know his daily activities. > - def daily_updates(user, open_items, completed_items, = > task_performed) > + def daily_updates(user, cc_list, open_items, completed_items, = > task_performed) > recipients user.email > + cc cc_list > from MAIL_CONFIG[:from] > subject "Daily updates for #{user.display_name}" > body :user =3D> user, :open_items =3D> open_items, > diff --git a/app/views/users/_notifications.html.erb b/app/views/ = > users/_notifications.html.erb > index 06b34fb..79e9518 100644 > --- a/app/views/users/_notifications.html.erb > +++ b/app/views/users/_notifications.html.erb > @@ -1,25 +1,40 @@ > <% form_for(:notifications, @this_user.notifications, :url =3D> = > notifications_user_path(@this_user)) do |form| %> > > > + > + > + > + > > > - > + > > > > > > - > - > + > > > > - > - > + > + > + > + > > > > - > > diff --git a/config/initializers/schedules.rb b/config/initializers/ = > schedules.rb > index 07b9618..83be588 100644 > --- a/config/initializers/schedules.rb > +++ b/config/initializers/schedules.rb > @@ -1,18 +1,18 @@ > # schedules.rb > # Copyright (C) 2008, Darryl L. Pierce > # > -# This program is free software: you can redistribute it and/or = > modify > -# it under the terms of the GNU General Public License as published = > by > -# the Free Software Foundation, either version 3 of the License, or > -# (at your option) any later version. > +# This program is free software: you can redistribute it and/or = > modify it under > +# the terms of the GNU General Public License as published by the = > Free Software > +# Foundation, either version 3 of the License, or (at your option) = > any later > +# version. > # > -# This program is distributed in the hope that it will be useful, > -# but WITHOUT ANY WARRANTY; without even the implied warranty of > -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > -# GNU General Public License for more details. > +# This program is distributed in the hope that it will be useful, = > but WITHOUT > +# ANY WARRANTY; without even the implied warranty of = > MERCHANTABILITY or FITNESS > +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for = > more > +# details. > # > -# You should have received a copy of the GNU General Public License > -# along with this program. If not, see licenses/>. > +# You should have received a copy of the GNU General Public License = > along with > +# this program. If not, see . > > require 'fastthread' > require 'openwfe/util/scheduler' > @@ -64,7 +64,18 @@ threads["daily updates"] =3D Thread.new do > > User.find(:all).each do |user| > if user.notifications.daily_updates > - UserMailer.deliver_daily_updates(user, open_items[user], > + cc_list =3D [] > + > + if user.notifications.updates_to_product_list > + tasks_performed[user].each do |task| > + product =3D task.backlog_item.sprint.product > + if product.has_mailing_list? && !cc_list.include? = > (product.mailing_list) > + cc_list << product.mailing_list > + end > + end > + end > + > + UserMailer.deliver_daily_updates(user, cc_list, = > open_items[user], > completed_items[user], tasks_performed[user]) > end > end > diff --git a/db/migrate/ = > 022_add_send_notifications_to_product_list.rb b/db/migrate/ = > 022_add_send_notifications_to_product_list.rb > new file mode 100644 > index 0000000..2c48cc7 > --- /dev/null > +++ b/db/migrate/022_add_send_notifications_to_product_list.rb > @@ -0,0 +1,26 @@ > +# 022_add_send_notifications_to_product_list.rb > +# Copyright (C) 2008, Darryl L. Pierce > +# > +# This program is free software: you can redistribute it and/or = > modify it under > +# the terms of the GNU General Public License as published by the = > Free Software > +# Foundation, either version 3 of the License, or (at your option) = > any later > +# version. > +# > +# This program is distributed in the hope that it will be useful, = > but WITHOUT > +# ANY WARRANTY; without even the implied warranty of = > MERCHANTABILITY or FITNESS > +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for = > more > +# details. > +# > +# You should have received a copy of the GNU General Public License = > along with > +# this program. If not, see . > +# > + > +class AddSendNotificationsToProductList < ActiveRecord::Migration > + def self.up > + = > add_column = > :notifications, :updates_to_product_list, :boolean, :default =3D> false > + end > + > + def self.down > + remove_column :notifications, :updates_to_product_list > + end > +end > diff --git a/db/schema.rb b/db/schema.rb > index 6c86037..90c8c4a 100644 > --- a/db/schema.rb > +++ b/db/schema.rb > @@ -9,7 +9,7 @@ > # > # It's strongly recommended to check this file into your version = > control system. > > -ActiveRecord::Schema.define(:version =3D> 21) do > +ActiveRecord::Schema.define(:version =3D> 22) do > > create_table "backlog_items", :force =3D> true do |t| > t.integer = > "sprint_id" = > , :null =3D> false > @@ -31,6 +31,7 @@ ActiveRecord::Schema.define(:version =3D> 21) do > t.boolean "daily_updates" > t.datetime "created_at" > t.datetime "updated_at" > + t.boolean "updates_to_product_list", :default =3D> false > end > > create_table "product_roles", :force =3D> true do |t| > -- = > 1.6.0.2 > > _______________________________________________ > projxp-devel mailing list > projxp-devel(a)lists.fedorahosted.org > https://fedorahosted.org/mailman/listinfo/projxp-devel --===============2564627102904632635==--
Email NotificationsEmail Notifications
Daily scrum email<%=3D form.check_box :daily_updates %> > + <%=3D form.check_box :daily_updates %> > + <%=3D form.label :daily_updates, "Send a daily updates." %> > +
Task reminders<%=3D form.check_box :task_reminders %> > + > + <%=3D form.check_box :updates_to_product_list %> > + <%=3D form.label :updates_to_product_list, "Send updates to = > product list (requires daily updates be enabled)." %> > +
> + <%=3D form.check_box :task_reminders %> > + <%=3D form.label :task_reminders, "Send daily task update = > reminders." %> > +
> + > <%=3D submit_tag "Update" %> >