多选查询去重,修改样式
This commit is contained in:
parent
e5da3c47ed
commit
e8cca08f40
|
@ -55,10 +55,11 @@ module PollHelper
|
|||
t == 0 ? 0 : format("%.2f", e*100/t)
|
||||
end
|
||||
|
||||
# def total_answer
|
||||
# poll_question.poll_votes(distinct a.ID
|
||||
# end
|
||||
#
|
||||
#多选的时候查询去重
|
||||
def total_answer id
|
||||
total = PollVote.find_by_sql("SELECT distinct(user_id) FROM `poll_votes` where poll_question_id = #{id}").count
|
||||
end
|
||||
|
||||
#页面体型显示
|
||||
def options_show pq
|
||||
case pq
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
<td class="td42"><%= poll_answer.poll_votes.count %> </td>
|
||||
<td class="td287">
|
||||
<div class="Bar">
|
||||
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, @poll.users.count) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
|
||||
<span style="width:<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%;" id="choice_percentage_<%= poll_answer.id %>"></span>
|
||||
</div>
|
||||
<%= statistics_result_percentage(poll_answer.poll_votes.count, @poll.users.count) %>%</td>
|
||||
<%= statistics_result_percentage(poll_answer.poll_votes.count, total_answer(poll_question.id)) %>%</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr class="table_bluebg">
|
||||
<td class="td327"><%= l(:label_poll_valid_commit) %> </td>
|
||||
<td class="td42"><%= poll_question.poll_votes.count %></td>
|
||||
<td class="td42"><%= total_answer(poll_question.id) %></td>
|
||||
<td class="td287"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
|
|
@ -42,7 +42,7 @@ ul.wlist li a:hover{ background:#15bccf; color:#fff; text-decoration:none;}
|
|||
|
||||
/*问卷页面*/
|
||||
.polls_box{ border:1px solid #dcdcdc; padding:15px 30px;}
|
||||
.ur_page_title{ font-size:16px; text-align:center; color:#353535;word-break: break-all; word-wrap: break-word;}
|
||||
.ur_page_title{ font-size:16px; text-align:center; color:#353535; word-break:break-all; word-wrap:break-word;}
|
||||
.ur_prefix_content{ color:#656565; text-indent:30px; margin-top:10px; }
|
||||
.ur_card{border-top:1px solid #dcdcdc;margin-top:20px; color:#3a3a3a;}
|
||||
.ur_title{ padding:20px 0px ; float:left; width:604px; word-break: break-all; word-wrap: break-word;}
|
||||
|
@ -60,8 +60,8 @@ a:hover.ur_button{ background:#0fa9bb; text-decoration:none;}
|
|||
.ur_progress_text{ text-align:center; font-size:14px;}
|
||||
|
||||
/*问卷结果*/
|
||||
.title_index{ color:#62bcd7;}
|
||||
.ur_title_result{ padding-top:20px;}
|
||||
.title_index{ color:#62bcd7; }
|
||||
.ur_title_result{ padding-top:20px; word-break:break-all; word-wrap:break-word;}
|
||||
.ur_table_result{ color:#5d5d5d;border-right:1px solid #cbcbcb;border-bottom:1px solid #cbcbcb;}
|
||||
.ur_table_result tr td{ border-left:1px solid #cbcbcb;border-top:1px solid #cbcbcb; height:20px;}
|
||||
.table_bluebg{ background:#d7e5ee; color:#2f3a40; height:24px;}
|
||||
|
|
Loading…
Reference in New Issue