Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
a35bc7a305
|
@ -0,0 +1,20 @@
|
|||
class UpdateHomeworkCommentStatus < ActiveRecord::Migration
|
||||
def up
|
||||
homeworks = HomeworkCommon.joins(:homework_detail_manual).where("publish_time is not NULL and publish_time <= '#{Date.today}' and homework_detail_manuals.comment_status = 0")
|
||||
homeworks.each do |homework|
|
||||
hw_dm = homework.homework_detail_manual
|
||||
if hw_dm && hw_dm.comment_status == 0
|
||||
if hw_dm.evaluation_end < Date.today && homework.anonymous_comment == 0
|
||||
hw_dm.update_column("comment_status", 3)
|
||||
elsif homework.anonymous_comment == 0 && hw_dm.evaluation_end >= Date.today && hw_dm.evaluation_start <= Date.today
|
||||
hw_dm.update_column("comment_status", 2)
|
||||
else
|
||||
hw_dm.update_column("comment_status", 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
16
db/schema.rb
16
db/schema.rb
|
@ -11,7 +11,7 @@
|
|||
#
|
||||
# It's strongly recommended to check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(:version => 20161011012114) do
|
||||
ActiveRecord::Schema.define(:version => 20161015054820) do
|
||||
|
||||
create_table "activities", :force => true do |t|
|
||||
t.integer "act_id", :null => false
|
||||
|
@ -142,7 +142,7 @@ ActiveRecord::Schema.define(:version => 20161011012114) do
|
|||
t.integer "downloads", :default => 0
|
||||
t.integer "author_id"
|
||||
t.datetime "created_on"
|
||||
t.string "description"
|
||||
t.text "description"
|
||||
t.string "disk_directory"
|
||||
t.integer "attachtype"
|
||||
t.integer "is_public"
|
||||
|
@ -313,14 +313,16 @@ ActiveRecord::Schema.define(:version => 20161011012114) do
|
|||
add_index "changeset_parents", ["parent_id"], :name => "changeset_parents_parent_ids"
|
||||
|
||||
create_table "changesets", :force => true do |t|
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.integer "repository_id", :null => false
|
||||
t.string "revision", :null => false
|
||||
t.string "committer"
|
||||
t.datetime "committed_on", :null => false
|
||||
t.datetime "committed_on", :null => false
|
||||
t.text "comments"
|
||||
t.date "commit_date"
|
||||
t.string "scmid"
|
||||
t.integer "user_id"
|
||||
t.integer "project_id"
|
||||
t.integer "type", :default => 0
|
||||
end
|
||||
|
||||
add_index "changesets", ["committed_on"], :name => "index_changesets_on_committed_on"
|
||||
|
@ -971,6 +973,10 @@ ActiveRecord::Schema.define(:version => 20161011012114) do
|
|||
t.datetime "updated_at", :null => false
|
||||
end
|
||||
|
||||
create_table "innodb_monitor", :id => false, :force => true do |t|
|
||||
t.integer "a"
|
||||
end
|
||||
|
||||
create_table "invite_lists", :force => true do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "user_id"
|
||||
|
|
|
@ -4,6 +4,7 @@ namespace :homework_publishtime do
|
|||
desc "start publish homework and end homework"
|
||||
task :publish => :environment do
|
||||
puts "--------------------------------homework_publish start"
|
||||
Rails.logger.info("log--------------------------------homework_publish start")
|
||||
homework_commons = HomeworkCommon.where("publish_time = '#{Date.today}'")
|
||||
homework_commons.each do |homework|
|
||||
homework_detail_manual = homework.homework_detail_manual
|
||||
|
@ -36,6 +37,7 @@ namespace :homework_publishtime do
|
|||
Mailer.run.homework_added(homework)
|
||||
end
|
||||
end
|
||||
Rails.logger.info("log--------------------------------homework_publish end")
|
||||
puts "--------------------------------homework_publish end"
|
||||
end
|
||||
|
||||
|
|
|
@ -4,10 +4,12 @@ namespace :resource_publish do
|
|||
desc "start publish resource"
|
||||
task :publish => :environment do
|
||||
puts "--------------------------------resource_publish start"
|
||||
Rails.logger.info("log--------------------------------resource_publish start")
|
||||
attachments = Attachment.where("publish_time = '#{Date.today}'")
|
||||
attachments.each do |attachment|
|
||||
attachment.update_column('is_publish', 1)
|
||||
end
|
||||
Rails.logger.info("log--------------------------------resource_publish end")
|
||||
puts "--------------------------------resource_publish end"
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue