official_module/lib/tasks/memberlog.rake

16 lines
512 B
Ruby

task :memberlog => :environment do
Dayoff.each do |dayoff|
if Time.now.between?(dayoff.start_dayoff,dayoff.end_dayoff)
log = MemberLog.new
log.todo_translations = {"en" => "", "zh_tw" => ""}
log.complete_translations = {"en" => "", "zh_tw" => ""}
log.excuse_translations = {"en" => dayoff.dayoff_description, "zh_tw" => dayoff.dayoff_description }
log.member_profile_id = dayoff.member_profile_id
log.checkout = Time.now
log.dayoff = true
log.finish = true
log.save
end
end
end