From f3d9a89ff5f0b9ebdd87ba0623d8141ed8b92e10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Tue, 22 Oct 2019 09:36:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/css/members.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/css/members.css b/public/react/src/modules/courses/css/members.css index ab7effaa0..22e83a93e 100644 --- a/public/react/src/modules/courses/css/members.css +++ b/public/react/src/modules/courses/css/members.css @@ -1,6 +1,6 @@ .studentList_operation_ul{ color: #999; - font-size: 12px; + font-size: 14px; float: right; margin-top: 2px; } From 266fcfc4c75786d31d874308d0d8c65852fe7402 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 22 Oct 2019 09:55:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E7=AE=80?= =?UTF-8?q?=E7=AD=94=E9=A2=98=E5=9B=9E=E7=AD=94bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_votes_controller.rb | 37 ++++++++++++++---------- app/helpers/polls_helper.rb | 2 +- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb index b1191d8ea..4a15ae301 100644 --- a/app/controllers/poll_votes_controller.rb +++ b/app/controllers/poll_votes_controller.rb @@ -16,9 +16,9 @@ class PollVotesController < ApplicationController # 当前用户的当前答案,如果已存在,当再次点击的时候,取消答案,即删除该答案 current_vote_text = nil - if user_votes.find_vote_text.present? - current_vote_text = user_votes.find_vote_text.first - end + # if user_votes.find_vote_text.present? + # current_vote_text = user_votes.find_vote_text.first + # end vote_answer_params = { :user_id => current_user.id, @@ -36,7 +36,6 @@ class PollVotesController < ApplicationController else if question_answer_text.present? - current_user_answer.update_attribute("vote_text", question_answer_text) end end @@ -48,17 +47,23 @@ class PollVotesController < ApplicationController if question_answer_ids.present? if question_answer_text.present? #有文字输入,但是不存在其他选项的 ques_vote_id = question_answer_ids.map(&:to_i).max - if current_vote_text.present? #已有其他输入文字的选项 + if user_votes.find_vote_text.present? + current_vote_text = user_votes.find_vote_text.first current_vote_text.update_attribute("vote_text", question_answer_text) else answer_option = { - :user_id => current_user.id, - :poll_question_id => @poll_question.id, - :poll_answer_id => ques_vote_id, - :vote_text => question_answer_text + :user_id => current_user.id, + :poll_question_id => @poll_question.id, + :poll_answer_id => ques_vote_id, + :vote_text => question_answer_text } PollVote.create(answer_option) end + # if current_vote_text.present? #已有其他输入文字的选项 + # current_vote_text.update_attribute("vote_text", question_answer_text) + # else + # + # end end ea_ids = user_votes.pluck(:poll_answer_id) @@ -85,12 +90,14 @@ class PollVotesController < ApplicationController user_votes.destroy_all end else #主观题的输入 - if current_vote_text.present? - if question_answer_text.present? - user_votes.first.update_attribute("vote_text", question_answer_text) - else - user_votes.destroy_all - end + # current_vote_text = user_votes.find_vote_text + if user_votes.present? + user_votes.first.update_attribute("vote_text", question_answer_text) + # if question_answer_text.present? + # user_votes.first.update_attribute("vote_text", question_answer_text) + # else + # user_votes.destroy_all + # end else PollVote.create(vote_answer_params) end diff --git a/app/helpers/polls_helper.rb b/app/helpers/polls_helper.rb index 52e90f559..03210fccd 100644 --- a/app/helpers/polls_helper.rb +++ b/app/helpers/polls_helper.rb @@ -13,7 +13,7 @@ module PollsHelper end def poll_votes_count(votes,user_ids) - votes.find_current_vote("user_id",user_ids.uniq).size + votes.find_current_vote("user_id",user_ids.uniq).reject(&:blank?).size end #公用tab页的相关信息 From afb3181f889bbc99d33dca05bd73a22af1e35960 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Tue, 22 Oct 2019 10:01:03 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E7=9A=84=E7=AE=80?= =?UTF-8?q?=E7=AD=94=E9=A2=98=E5=9B=9E=E7=AD=94bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/poll_votes_controller.rb | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/app/controllers/poll_votes_controller.rb b/app/controllers/poll_votes_controller.rb index 4a15ae301..1690fd3ae 100644 --- a/app/controllers/poll_votes_controller.rb +++ b/app/controllers/poll_votes_controller.rb @@ -91,15 +91,17 @@ class PollVotesController < ApplicationController end else #主观题的输入 # current_vote_text = user_votes.find_vote_text - if user_votes.present? - user_votes.first.update_attribute("vote_text", question_answer_text) - # if question_answer_text.present? - # user_votes.first.update_attribute("vote_text", question_answer_text) - # else - # user_votes.destroy_all - # end - else - PollVote.create(vote_answer_params) + if question_answer_text.present? + if user_votes.present? + user_votes.first.update_attribute("vote_text", question_answer_text) + # if question_answer_text.present? + # user_votes.first.update_attribute("vote_text", question_answer_text) + # else + # user_votes.destroy_all + # end + else + PollVote.create(vote_answer_params) + end end end @current_question_number = @poll_question.question_number