check poll_user create

dev_forum
SylorHuang 6 years ago
parent 665791f472
commit d44ada3751

@ -951,6 +951,7 @@ class PollsController < ApplicationController
def poll_lists
ActiveRecord::Base.transaction do
begin
@poll_new_users = @poll.poll_users.find_by(user_id:current_user.id)
poll_ids = [@poll.id]
@poll_list_status = @poll.get_poll_status(current_user.id)
@poll_publish_count = get_user_permission_course(poll_ids,2).count
@ -1184,7 +1185,7 @@ class PollsController < ApplicationController
def check_poll_commit_result
poll_status = @poll.get_poll_status(current_user.id)
commit_poll_user = @poll.poll_users.find_by_group_ids(current_user.id).commit_by_status(1) #当前用户已提交问卷的
unless @user_course_identity < Course::STUDENT || (@poll.show_result && poll_status == 3 && commit_poll_user.present?)
unless (@user_course_identity < Course::STUDENT) || (@poll.show_result && poll_status == 3 && commit_poll_user.present?)
normal_status(-1,"没有权限!") #当前为老师/问卷公开统计,且问卷已截止,且用户有过回答的
end
end

@ -1,7 +1,7 @@
json.course do
json.partial! "polls/course_name",locals:{course:@course}
end
json.current_poll_user @poll_new_users.present? ? @poll_new_users.id : "---"
json.poll_types do
if @poll_current_user_status == 0
json.published_count @poll_publish_count

Loading…
Cancel
Save