diff --git a/app/assets/javascripts/admins/competitions/index.js b/app/assets/javascripts/admins/competitions/index.js index ae4593d33..c476dbf24 100644 --- a/app/assets/javascripts/admins/competitions/index.js +++ b/app/assets/javascripts/admins/competitions/index.js @@ -5,7 +5,69 @@ $(document).on('turbolinks:load', function() { $imageElement.attr('src', data.url); $imageElement.show(); $imageElement.next().html('重新上传'); - }) + }); } + + $(".admin-competition-list-form").on("change", '.competitions-hot-select', function () { + var s_value = $(this).get(0).checked ? 1 : 0; + var json = {}; + json["hot"] = s_value; + $.ajax({ + url: "/admins/competitions/hot_setting", + type: "POST", + dataType:'json', + data: json, + success: function(){ + $.notify({ message: '操作成功' }); + } + }); + }); + + // ============== 新增竞赛 =============== + var $modal = $('.modal.admin-create-competition-modal'); + var $form = $modal.find('form.admin-create-competition-form'); + var $competitionNameInput = $form.find('input[name="competition_name"]'); + + $form.validate({ + errorElement: 'span', + errorClass: 'danger text-danger', + rules: { + competition_name: { + required: true + } + } + }); + + // modal ready fire + $modal.on('show.bs.modal', function () { + $competitionNameInput.val(''); + }); + + $modal.on('click', '.submit-btn', function(){ + $form.find('.error').html(''); + + if ($form.valid()) { + var url = $form.data('url'); + + $.ajax({ + method: 'POST', + dataType: 'json', + url: url, + data: $form.serialize(), + success: function(){ + $.notify({ message: '创建成功' }); + $modal.modal('hide'); + + setTimeout(function(){ + window.location.reload(); + }, 500); + }, + error: function(res){ + var data = res.responseJSON; + $form.find('.error').html(data.message); + } + }); + } + }); }); diff --git a/app/assets/javascripts/admins/enroll_lists/index.js b/app/assets/javascripts/admins/enroll_lists/index.js new file mode 100644 index 000000000..04bd95070 --- /dev/null +++ b/app/assets/javascripts/admins/enroll_lists/index.js @@ -0,0 +1,9 @@ +$(document).on('turbolinks:load', function() { + if($('body.admins-enroll-lists-index-page').length > 0){ + let search_form = $(".search-form"); + //导出 + $(".competition-enroll-list-form").on("click","#enroll-lists-export",function () { + window.location.href = "/admins/competitions/"+$(this).attr("data-competition-id")+"/enroll_lists.xls?" + search_form.serialize(); + }); + } +}); \ No newline at end of file diff --git a/app/controllers/admins/competitions_controller.rb b/app/controllers/admins/competitions_controller.rb index f501564ab..2e2dbd4e2 100644 --- a/app/controllers/admins/competitions_controller.rb +++ b/app/controllers/admins/competitions_controller.rb @@ -18,12 +18,27 @@ class Admins::CompetitionsController < Admins::BaseController end end + def create + name = params[:competition_name].to_s.strip + Competition.create!(name: name) + render_ok + end + + def hot_setting + if params[:hot].to_i == 1 && !ModuleSetting.exists?(module_type: "Competition", property: "hot") + ModuleSetting.create!(module_type: "Competition", property: "hot") + elsif params[:hot].to_i == 0 && ModuleSetting.exists?(module_type: "Competition", property: "hot") + ModuleSetting.where(module_type: "Competition", property: "hot").destroy_all + end + render_ok + end + def publish - @competition.update_attributes!(:published_at, Time.now) + @competition.update_attributes!(published_at: Time.now) end def unpublish - @competition.update_attributes!(:published_at, nil) + @competition.update_attributes!(published_at: nil) end def online_switch @@ -34,10 +49,6 @@ class Admins::CompetitionsController < Admins::BaseController end end - def enroll_list - - end - private def find_competition diff --git a/app/controllers/admins/enroll_lists_controller.rb b/app/controllers/admins/enroll_lists_controller.rb new file mode 100644 index 000000000..ccac6a72d --- /dev/null +++ b/app/controllers/admins/enroll_lists_controller.rb @@ -0,0 +1,25 @@ +class Admins::EnrollListsController < Admins::BaseController + + def index + @competition = current_competition + params[:sort_by] = params[:sort_by].presence || 'created_at' + params[:sort_direction] = params[:sort_direction].presence || 'desc' + enroll_lists = Admins::CompetitionEnrollListQuery.call(@competition, params) + + @params_page = params[:page] || 1 + @enroll_lists = paginate enroll_lists.preload(competition_team: [:user, :teachers], user: { user_extension: :school }) + @personal = @competition.personal? + + respond_to do |format| + format.js + format.html + format.xls + end + end + + private + def current_competition + @_current_competition ||= Competition.find(params[:competition_id]) + end + +end \ No newline at end of file diff --git a/app/controllers/competitions/competition_teams_controller.rb b/app/controllers/competitions/competition_teams_controller.rb index f504b226e..6a4dbfd34 100644 --- a/app/controllers/competitions/competition_teams_controller.rb +++ b/app/controllers/competitions/competition_teams_controller.rb @@ -59,6 +59,7 @@ class Competitions::CompetitionTeamsController < Competitions::BaseController end def index + @personal = current_competition.personal? admin_or_business? ? all_competition_teams : user_competition_teams end diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index d71b72618..99356946f 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1129,7 +1129,7 @@ class ExercisesController < ApplicationController :subjective_score => subjective_score, :commit_method => @answer_committed_user&.commit_method.to_i > 0 ? @answer_committed_user&.commit_method.to_i : params[:commit_method].to_i } - @answer_committed_user.update_attributes(commit_option) + @answer_committed_user.update_attributes!(commit_option) CommitExercsieNotifyJobJob.perform_later(@exercise.id, current_user.id) normal_status(0,"试卷提交成功!") else diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 395d67913..eadbfa05c 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -414,7 +414,7 @@ module ExercisesHelper score2 = 0.0 #填空题 score5 = 0.0 #实训题 ques_stand = [] #问题是否正确 - exercise_questions = exercise.exercise_questions.includes(:exercise_answers,:exercise_shixun_answers,:exercise_standard_answers,:exercise_shixun_challenges) + exercise_questions = exercise.exercise_questions.includes(:exercise_standard_answers,:exercise_shixun_challenges) exercise_questions&.each do |q| begin if q.question_type != 5 diff --git a/app/models/competition.rb b/app/models/competition.rb index 23b1e3c81..684db8fa5 100644 --- a/app/models/competition.rb +++ b/app/models/competition.rb @@ -55,7 +55,7 @@ class Competition < ApplicationRecord # 是否为个人赛 def personal? - competition_staffs.maximum(:maximum) == 1 + competition_staffs.maximum(:maximum) == 1 || max_num == 1 end # 报名是否结束 @@ -101,7 +101,7 @@ class Competition < ApplicationRecord private def create_competition_modules - CompetitionModule.bulk_insert(*%i[competition_id name position]) do |worker| + CompetitionModule.bulk_insert(*%i[competition_id name position created_at updated_at]) do |worker| %w(首页 报名 通知公告 排行榜 资料下载).each_with_index do |name, index| worker.add(competition_id: id, name: name, position: index + 1) end diff --git a/app/models/competition_team.rb b/app/models/competition_team.rb index 878f58882..6c2b99859 100644 --- a/app/models/competition_team.rb +++ b/app/models/competition_team.rb @@ -32,6 +32,15 @@ class CompetitionTeam < ApplicationRecord code end + def teachers_info + info = "" + teachers.each do |teacher| + teacher_info = "#{teacher.user.real_name}/#{teacher.user.school_name}" + info += info == "" ? teacher_info : "、#{teacher_info}" + end + info + end + def teachers_name teachers.map{|teacher| teacher.user.real_name}.join(",") end diff --git a/app/models/user.rb b/app/models/user.rb index 103f9e0b5..135b85e25 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -237,6 +237,11 @@ class User < ApplicationRecord professional_certification end + # 学校所在的地区 + def school_province + user_extension&.school&.province || '' + end + # 用户的学校名称 def school_name user_extension&.school&.name || '' diff --git a/app/queries/admins/competition_enroll_list_query.rb b/app/queries/admins/competition_enroll_list_query.rb new file mode 100644 index 000000000..64f5dc7f8 --- /dev/null +++ b/app/queries/admins/competition_enroll_list_query.rb @@ -0,0 +1,40 @@ +class Admins::CompetitionEnrollListQuery < ApplicationQuery + include CustomSortable + + attr_reader :competition, :params + + sort_columns :created_at, :competition_team_id, default_by: :created_at, default_direction: :desc + + def initialize(competition, params) + @competition = competition + @params = params + end + + def call + members = competition.team_members + only_teacher = competition.competition_staffs.count == 1 && competition.competition_staffs.first.category == 'teacher' + members = members.where("team_members.is_teacher = 0") unless only_teacher # 只有老师报名时才显示老师,此时老师作为队员 + + + school = params[:school].to_s.strip + if school.present? + school_ids = School.where("schools.name like ?", "%#{school}%").pluck(:id) + school_ids = school_ids.size == 0 ? "(-1)" : "(" + school_ids.join(",") + ")" + members = members.joins(user: :user_extension).where("user_extensions.school_id in #{school_ids}") + end + + location = params[:location].to_s.strip + if location.present? + members = members.joins(user: { user_extension: :school }).where("schools.province like ?", "%#{location}%") + end + + # 关键字模糊查询 + keyword = params[:keyword].to_s.strip + if keyword.present? + members = members.joins(:competition_team) + .where('competition_teams.name LIKE :keyword', keyword: "%#{keyword}%") + end + + custom_sort(members, params[:sort_by], params[:sort_direction]) + end +end \ No newline at end of file diff --git a/app/tasks/exercise_publish_task.rb b/app/tasks/exercise_publish_task.rb index a7b533d05..4e34320ea 100644 --- a/app/tasks/exercise_publish_task.rb +++ b/app/tasks/exercise_publish_task.rb @@ -69,7 +69,7 @@ class ExercisePublishTask :subjective_score => subjective_score, :commit_method => exercise_user&.commit_method.to_i > 0 ? exercise_user&.commit_method.to_i : 3 } - exercise_user.update_attributes(commit_option) + exercise_user.update_attributes!(commit_option) end rescue Exception => e Rails.logger.info("rescue errors ___________________________#{e}") diff --git a/app/views/admins/competitions/enroll_list.html.erb b/app/views/admins/competitions/enroll_list.html.erb deleted file mode 100644 index e69de29bb..000000000 diff --git a/app/views/admins/competitions/index.html.erb b/app/views/admins/competitions/index.html.erb index 736f0514e..41e061fc1 100644 --- a/app/views/admins/competitions/index.html.erb +++ b/app/views/admins/competitions/index.html.erb @@ -2,22 +2,26 @@ <% add_admin_breadcrumb('竞赛列表', admins_competitions_path) %> <% end %> -
-
-
- <% imageExists = File.exist?(disk_filename("Competition", "banner")) %> - <% imageUrl = imageExists ? '/' + banner_img("Competition") + "?#{Time.now.to_i}" : '' %> - 竞赛主页banner - <%= image_tag(imageUrl, width: 150, height: 50, class: "preview-image competition-image-banner mr-1", data: { toggle: 'tooltip', title: '点击预览' }) %> - <%= javascript_void_link imageExists ? '重新上传' : '上传图片', class: 'action upload-competition-image-action', data: { source_id: "banner", source_type: 'Competition', toggle: 'modal', target: '.admin-upload-file-modal' } %> -
+
+
+
+
+ <% imageExists = File.exist?(disk_filename("Competition", "banner")) %> + <% imageUrl = imageExists ? '/' + banner_img("Competition") + "?#{Time.now.to_i}" : '' %> + 竞赛主页banner + <%= image_tag(imageUrl, width: 150, height: 50, class: "preview-image competition-image-banner mr-1", data: { toggle: 'tooltip', title: '点击预览' }) %> + <%= javascript_void_link imageExists ? '重新上传' : '上传图片', class: 'action upload-competition-image-action', data: { source_id: "banner", source_type: 'Competition', toggle: 'modal', target: '.admin-upload-file-modal' } %> +
-
- +
+ +
+ + <%= javascript_void_link '新增', class: 'btn btn-primary', data: { toggle: 'modal', target: '.admin-create-competition-modal' } %>
@@ -25,4 +29,5 @@ <%= render partial: 'admins/competitions/shared/list', locals: { competitions: @competitions } %>
+<%= render 'admins/competitions/shared/create_competition_modal' %> <%= render partial: 'admins/shared/modal/upload_file_modal', locals: { title: '上传图片' } %> \ No newline at end of file diff --git a/app/views/admins/competitions/index.js.erb b/app/views/admins/competitions/index.js.erb new file mode 100644 index 000000000..e0985ce5e --- /dev/null +++ b/app/views/admins/competitions/index.js.erb @@ -0,0 +1 @@ +$('.competitions-list-container').html("<%= j( render partial: 'admins/competitions/shared/list', locals: { competitions: @competitions } ) %>"); \ No newline at end of file diff --git a/app/views/admins/competitions/online_switch.js.erb b/app/views/admins/competitions/online_switch.js.erb index e69de29bb..f67122e46 100644 --- a/app/views/admins/competitions/online_switch.js.erb +++ b/app/views/admins/competitions/online_switch.js.erb @@ -0,0 +1,4 @@ +var page_no = $("#competition-item-<%= @competition.id %>").children(":first").html(); +$("#competition-item-<%= @competition.id %>").html("<%= j render partial: "admins/competitions/shared/td", locals: {competition: @competition, page_no: 1} %>"); +$("#competition-item-<%= @competition.id %>").children(":first").html(page_no); +show_success_flash(); \ No newline at end of file diff --git a/app/views/admins/competitions/publish.js.erb b/app/views/admins/competitions/publish.js.erb index e69de29bb..f67122e46 100644 --- a/app/views/admins/competitions/publish.js.erb +++ b/app/views/admins/competitions/publish.js.erb @@ -0,0 +1,4 @@ +var page_no = $("#competition-item-<%= @competition.id %>").children(":first").html(); +$("#competition-item-<%= @competition.id %>").html("<%= j render partial: "admins/competitions/shared/td", locals: {competition: @competition, page_no: 1} %>"); +$("#competition-item-<%= @competition.id %>").children(":first").html(page_no); +show_success_flash(); \ No newline at end of file diff --git a/app/views/admins/competitions/shared/_create_competition_modal.html.erb b/app/views/admins/competitions/shared/_create_competition_modal.html.erb new file mode 100644 index 000000000..94d12ba32 --- /dev/null +++ b/app/views/admins/competitions/shared/_create_competition_modal.html.erb @@ -0,0 +1,28 @@ + \ No newline at end of file diff --git a/app/views/admins/competitions/shared/_list.html.erb b/app/views/admins/competitions/shared/_list.html.erb index 8f215d54c..6e9620a39 100644 --- a/app/views/admins/competitions/shared/_list.html.erb +++ b/app/views/admins/competitions/shared/_list.html.erb @@ -18,7 +18,7 @@ <% competitions.each_with_index do |competition, index| %> <% page_no = list_index_no(@params_page.to_i, index) %> - <%= render partial: "admins/competitions/shared/td",locals: {competition: competition, page_no: page_no} %> + <%= render partial: "admins/competitions/shared/td", locals: {competition: competition, page_no: page_no} %> <% end %> <% else %> diff --git a/app/views/admins/competitions/shared/_td.html.erb b/app/views/admins/competitions/shared/_td.html.erb index 09dcf48b3..394a41d79 100644 --- a/app/views/admins/competitions/shared/_td.html.erb +++ b/app/views/admins/competitions/shared/_td.html.erb @@ -1,6 +1,6 @@ <%= page_no %> - <%= link_to competition.name, enroll_list_admins_competition_path(competition), :target => "_blank", :title => competition.name %> + <%= link_to competition.name, admins_competition_enroll_lists_path(competition), :title => competition.name %> <%= competition.sub_title %> <%= competition.mode_type %> @@ -15,7 +15,7 @@ <%= competition.created_at.strftime('%Y-%m-%d %H:%M') %> - <%= link_to '配置', admins_competition_competition_setting_path(competition), class: 'action edit-action' %> + <%= link_to '配置', admins_competition_competition_settings_path(competition), class: 'action edit-action' %> <% if !competition.status? && competition.published_at.blank? %> <%= link_to '发布', publish_admins_competition_path(competition), class: 'action publish-action', method: :post, remote: true %> diff --git a/app/views/admins/competitions/unpublish.js.erb b/app/views/admins/competitions/unpublish.js.erb index e69de29bb..f67122e46 100644 --- a/app/views/admins/competitions/unpublish.js.erb +++ b/app/views/admins/competitions/unpublish.js.erb @@ -0,0 +1,4 @@ +var page_no = $("#competition-item-<%= @competition.id %>").children(":first").html(); +$("#competition-item-<%= @competition.id %>").html("<%= j render partial: "admins/competitions/shared/td", locals: {competition: @competition, page_no: 1} %>"); +$("#competition-item-<%= @competition.id %>").children(":first").html(page_no); +show_success_flash(); \ No newline at end of file diff --git a/app/views/admins/enroll_lists/_list.html.erb b/app/views/admins/enroll_lists/_list.html.erb new file mode 100644 index 000000000..2b86a3507 --- /dev/null +++ b/app/views/admins/enroll_lists/_list.html.erb @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + <% if enroll_lists.present? %> + <% enroll_lists.each_with_index do |member, index| %> + + <% team = member.competition_team %> + <% page_no = list_index_no(@params_page.to_i, index) %> + + + + + + + + + + + + + <% end %> + <% else %> + <%= render 'admins/shared/no_data_for_table' %> + <% end %> + +
序号<%= sort_tag('战队ID', name: 'competition_team_id', path: admins_competition_enroll_lists_path(@competition)) %>战队名称创建者队员姓名职业学号队员学校地区指导老师<%= sort_tag('报名时间', name: 'created_at', path: admins_competition_enroll_lists_path(@competition)) %>
<%= page_no %><%= member.competition_team_id %><%= @personal ? "--" : team.name %><%= team.user.real_name %><%= member.user.real_name %><%= member.user.identity %><%= member.user.student_id %><%= member.user.school_name %><%= member.user.school_province %><%= @personal ? "--" : team.teachers_info %><%= member.created_at.strftime('%Y-%m-%d %H:%M') %>
+ +<%= render partial: 'admins/shared/paginate', locals: { objects: enroll_lists } %> \ No newline at end of file diff --git a/app/views/admins/enroll_lists/index.html.erb b/app/views/admins/enroll_lists/index.html.erb new file mode 100644 index 000000000..95787d54c --- /dev/null +++ b/app/views/admins/enroll_lists/index.html.erb @@ -0,0 +1,33 @@ +<% + define_admin_breadcrumbs do + add_admin_breadcrumb('竞赛列表', admins_competitions_path) + add_admin_breadcrumb(@competition.name) + end +%> + +
+ + +
+ <%= form_tag(admins_competition_enroll_lists_path(unsafe_params), method: :get, class: 'form-inline search-form mt-3 flex-1 d-flex', remote: true) do %> + <%= text_field_tag(:keyword, params[:keyword], class: 'form-control col-sm-2 ml-3', placeholder: '战队名称检索') %> + <%= text_field_tag(:school, params[:school], class: 'form-control col-sm-2 ml-3', placeholder: '队员学校名称检索') %> + <%= text_field_tag(:location, params[:location], class: 'form-control col-sm-2 ml-3', placeholder: '队员地区检索') %> + <%= submit_tag('搜索', class: 'btn btn-primary ml-3', 'data-disable-with': '搜索中...') %> + <%= link_to "清除", admins_competition_enroll_lists_path(@competition), class: "btn btn-default",'data-disable-with': '清除中...' %> + <% end %> + + 导出 +
+
+ +
+ <%= render(partial: 'admins/enroll_lists/list', locals: { enroll_lists: @enroll_lists }) %> +
\ No newline at end of file diff --git a/app/views/admins/enroll_lists/index.js.erb b/app/views/admins/enroll_lists/index.js.erb new file mode 100644 index 000000000..18edd97f2 --- /dev/null +++ b/app/views/admins/enroll_lists/index.js.erb @@ -0,0 +1 @@ +$('.competition-enroll-list-container').html("<%= j( render(partial: 'admins/enroll_lists/list', locals: { enroll_lists: @enroll_lists }) ) %>"); \ No newline at end of file diff --git a/app/views/competitions/competition_teams/index.json.jbuilder b/app/views/competitions/competition_teams/index.json.jbuilder index b641b28e6..d44fcdf1c 100644 --- a/app/views/competitions/competition_teams/index.json.jbuilder +++ b/app/views/competitions/competition_teams/index.json.jbuilder @@ -1,4 +1,5 @@ json.count @count +json.personal @personal json.competition_teams do json.array! @teams.each do |team| json.extract! team, :id, :name, :invite_code diff --git a/config/routes.rb b/config/routes.rb index ff7f798de..6013eaf3f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1012,14 +1012,18 @@ Rails.application.routes.draw do end end - resources :competitions, only: [:index, :destroy] do + resources :competitions, only: [:index, :destroy, :create] do member do post :publish post :unpublish post :online_switch - get :enroll_list end - resource :competition_setting, only: [:show, :update] + collection do + post :hot_setting + end + + resources :competition_settings, only: [:index, :update] + resources :enroll_lists, only: [:index] end end diff --git a/db/migrate/20191021141738_migrate_exercise_challenge_score.rb b/db/migrate/20191021141738_migrate_exercise_challenge_score.rb new file mode 100644 index 000000000..6d67398db --- /dev/null +++ b/db/migrate/20191021141738_migrate_exercise_challenge_score.rb @@ -0,0 +1,25 @@ +class MigrateExerciseChallengeScore < ActiveRecord::Migration[5.2] + include ExercisesHelper + def change + exercise = Exercise.find_by(id: 2734) + if exercise + exercise.exercise_users.where("start_at is not null").each do |exercise_user| + if exercise_user.end_at.nil? + calculate_score = calculate_student_score(exercise, exercise_user.user)[:total_score] + subjective_score = exercise_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + exercise_user.update_attributes!(score:total_score,objective_score:calculate_score,end_at:exercise.end_time,commit_status:1,status:1,commit_method:3) + puts exercise_user.id + else + calculate_score = ExerciseShixunAnswer.where(user_id: exercise_user.user_id, exercise_question_id: exercise.exercise_questions.pluck(:id)).pluck(:score).sum + subjective_score = exercise_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + exercise_user.update_attributes!(score:total_score,objective_score:calculate_score) if total_score > exercise_user.score + puts exercise_user.id + end + end + end + end +end diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 9cf68503d..793542f4b 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -47,7 +47,8 @@ export function initAxiosInterceptors(props) { proxy="https://pre-newweb.educoder.net" proxy="https://test-newweb.educoder.net" - // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; + + // 在这里使用requestMap控制,避免用户通过双击等操作发出重复的请求; // 如果需要支持重复的请求,考虑config里面自定义一个allowRepeat参考来控制 const requestMap = {}; diff --git a/public/react/src/modules/courses/poll/PollDetailTabSecond.js b/public/react/src/modules/courses/poll/PollDetailTabSecond.js index cebae4153..bf8d8b5f8 100644 --- a/public/react/src/modules/courses/poll/PollDetailTabSecond.js +++ b/public/react/src/modules/courses/poll/PollDetailTabSecond.js @@ -25,6 +25,7 @@ class PollDetailTabSecond extends Component{ axios.get(url).then((result)=>{ if(result){ this.setState({ + page: page, questions:result.data.questions, questionsInfo:result.data.question_types }) @@ -55,7 +56,7 @@ class PollDetailTabSecond extends Component{ } render(){ - let{page,limit,questions,question_types}=this.state; + let {page, limit, questions, questionsInfo} = this.state; return(
{ @@ -160,9 +161,10 @@ class PollDetailTabSecond extends Component{ }): } { - question_types && question_types.q_counts>limit && + questionsInfo && questionsInfo.q_counts > limit &&
- +
}