diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index ac7ee616f..900af0e77 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -352,7 +352,7 @@ class UsersController < ApplicationController homework = HomeworkCommon.new homework.name = params[:homework_common][:name] homework.description = params[:homework_common][:description] - homework.end_time = params[:homework_common][:end_time] + homework.end_time = params[:homework_common][:end_time] || Time.now homework.publish_time = Time.now homework.homework_type = 1 homework.late_penalty = 2 diff --git a/app/helpers/poll_helper.rb b/app/helpers/poll_helper.rb index 170e1b92c..84e12f3b1 100644 --- a/app/helpers/poll_helper.rb +++ b/app/helpers/poll_helper.rb @@ -37,7 +37,17 @@ module PollHelper pv.vote_text end end - + + #判断用户是否已经提交了问卷 + def has_commit_poll?(poll_id,user_id) + pu = PollUser.find_by_poll_id_and_user_id(poll_id,user_id) + if pu.nil? + false + else + true + end + end + #统计答题百分比,统计结果保留两位小数 def statistics_result_percentage(e, t) e = e.to_f diff --git a/app/views/courses/new.html.erb b/app/views/courses/new.html.erb index 75979d9f3..8c7a41ddc 100644 --- a/app/views/courses/new.html.erb +++ b/app/views/courses/new.html.erb @@ -50,7 +50,7 @@