diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index deeefcd75..3f1a66eb4 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -73,6 +73,11 @@ class StudentWorkController < ApplicationController stundet_work.homework_common_id = @homework.id stundet_work.user_id = User.current.id stundet_work.save_attachments(params[:attachments]) + if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d") + stundet_work.late_penalty = @homework.late_penalty + else + stundet_work.late_penalty = 0 + end render_attachment_warning_if_needed(stundet_work) if stundet_work.save respond_to do |format| diff --git a/db/schema.rb b/db/schema.rb index c0d1ce7fc..988d5649a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150630031857) do +ActiveRecord::Schema.define(:version => 20150702073308) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1231,6 +1231,8 @@ ActiveRecord::Schema.define(:version => 20150630031857) do t.integer "project_id", :default => 0 t.datetime "created_at", :null => false t.datetime "updated_at", :null => false + t.integer "late_penalty", :default => 0 + t.integer "absence_penalty", :default => 0 end create_table "student_works_evaluation_distributions", :force => true do |t|