Merge branch 'dev_hjq' of http://repository.trustie.net/xianbo/trustie2 into dev_hjq
This commit is contained in:
commit
0bb8b175e6
|
@ -42,7 +42,7 @@ class SystemMessagesController < ApplicationController
|
|||
@system_messages.user_id = User.current.id
|
||||
respond_to do |format|
|
||||
if @system_messages.save
|
||||
format.html {redirect_to system_messages_url(@project)}
|
||||
format.html {redirect_to user_message_path(User.current, :type => "system_message")}
|
||||
flash[:notice] = l(:notice_successful_message)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,8 +34,10 @@ class Mailer < ActionMailer::Base
|
|||
end
|
||||
def method_missing(name, *args, &block)
|
||||
if Setting.delayjob_enabled? && Object.const_defined?('Delayed')
|
||||
# with delayed_job
|
||||
@target.delay.send(name, *args, &block)
|
||||
else
|
||||
# without delayed_job
|
||||
@target.send(name, *args, &block).deliver
|
||||
end
|
||||
end
|
||||
|
|
|
@ -265,7 +265,6 @@ RedmineApp::Application.routes.draw do
|
|||
collection do
|
||||
post 'create', :as => 'system_messages'
|
||||
get 'index', :as => 'index'
|
||||
get 'show', :as => 'show'
|
||||
end
|
||||
end
|
||||
# match 'system_messages/index', to: 'system_messages#index', :via => :get, :as => 'system_messages'
|
||||
|
|
|
@ -202,13 +202,5 @@ END_DESC
|
|||
Mailer.run.send_for_user_activities(user, Date.today, 1)
|
||||
end
|
||||
end
|
||||
|
||||
desc "send a message for Job deadline"
|
||||
task :message => :environment do
|
||||
users = User.where(mail_notification: 'day')
|
||||
users.each do |user|
|
||||
Mailer.run.send_for_user_activities(user, Date.today, 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
#coding=utf-8
|
||||
|
||||
namespace :homework_endtime do
|
||||
desc "send a message for Job deadline"
|
||||
task :message => :environment do
|
||||
current_day = Date.today.day
|
||||
homework_commons = HomeworkCommon.where("end_time >?",Date.today)
|
||||
homework_commons.each do |homework_common|
|
||||
if homework_common.end_time.day - Date.today.day < 2 && homework_common.end_time.year == Date.today.year
|
||||
homework_common.course.student.each do |s|
|
||||
homework_common.course_messages << CourseMessage.new(:user_id => s.student_id, :course_id => homework_common.course_id, :viewed => false, :status => true)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue