From 5ca5f67d56a85aa40925fb35b83619415039ef1e Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 30 Aug 2019 16:04:38 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E6=9F=A5=E7=9C=8B=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- app/views/games/picture_display.json.jbuilder | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index d97b7172c..77e1eee7d 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -440,7 +440,7 @@ class SubjectsController < ApplicationController # 用户进展和获取的标签 def user_subject_progress challenge_ids - pass_games = Game.select(:id, :cost_time, :challenge_id).where(status: 2, user_id: current_user.id, challenge_id: challenge_ids) if current_user.logged? + pass_games = Challenge.left_joins(:games).where(challenges: {id: challenge_ids},games: {status: 2, user_id: current_user.id}) if current_user.logged? @all_score = Challenge.where(id: challenge_ids).sum(:score) # 如果没有通关的,没必要再继续统计了 diff --git a/app/views/games/picture_display.json.jbuilder b/app/views/games/picture_display.json.jbuilder index eb2309f9b..7fdc2cfc1 100644 --- a/app/views/games/picture_display.json.jbuilder +++ b/app/views/games/picture_display.json.jbuilder @@ -19,7 +19,7 @@ if @type == "image" end elsif @type == "html" - json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe + json.iframe_src File.read("#{@user_path}/#{@user_picture[0]}")&.html_safe if @user_picture[0].present? elsif @type == "txt" json.contents @contents.to_s elsif @type =="qrcode" From dfa86d26640e2d7204a3e1e332b6d826e475ff31 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 30 Aug 2019 16:10:02 +0800 Subject: [PATCH 02/13] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/subjects_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 77e1eee7d..d97b7172c 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -440,7 +440,7 @@ class SubjectsController < ApplicationController # 用户进展和获取的标签 def user_subject_progress challenge_ids - pass_games = Challenge.left_joins(:games).where(challenges: {id: challenge_ids},games: {status: 2, user_id: current_user.id}) if current_user.logged? + pass_games = Game.select(:id, :cost_time, :challenge_id).where(status: 2, user_id: current_user.id, challenge_id: challenge_ids) if current_user.logged? @all_score = Challenge.where(id: challenge_ids).sum(:score) # 如果没有通关的,没必要再继续统计了 From a19771cb4cf1b8191e16e0de9349010c1371a809 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 30 Aug 2019 16:10:36 +0800 Subject: [PATCH 03/13] =?UTF-8?q?=E5=88=A4=E7=A9=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/context/EvaluateSuccessEffectDisplay.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/context/EvaluateSuccessEffectDisplay.js b/public/react/src/context/EvaluateSuccessEffectDisplay.js index ec34db31f..98e61520b 100644 --- a/public/react/src/context/EvaluateSuccessEffectDisplay.js +++ b/public/react/src/context/EvaluateSuccessEffectDisplay.js @@ -21,7 +21,7 @@ class EvaluateSuccessEffectDisplay extends Component { componentDidMount() { if (this.props.type == 'html') { const iframe = document.getElementById('_displayIframe') - if (iframe && iframe.contentWindow) { + if (iframe && iframe.contentWindow && this.props.iframe_src) { iframe.contentWindow.open() iframe.contentWindow.document.write(this.props.iframe_src); iframe.contentWindow.document.close(); From 4b6da7f1f6f1c90a46cbbce24366f14d22e7f75d Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 30 Aug 2019 16:27:59 +0800 Subject: [PATCH 04/13] repo path --- app/controllers/concerns/git_common.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/concerns/git_common.rb b/app/controllers/concerns/git_common.rb index 93f5fecd7..4bc566a05 100644 --- a/app/controllers/concerns/git_common.rb +++ b/app/controllers/concerns/git_common.rb @@ -47,6 +47,7 @@ module GitCommon def add_file @path, message, content = params[:path].strip, params[:message], params[:content] author_name, author_email = current_user.real_name, current_user.git_mail + Logger.info("...repo_path is #{@repo_path}") @content = GitService.update_file(repo_path: @repo_path, file_path: @path, message: message, From 4984451656ff8b063ea4957f448b4d9e3cd917a1 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 30 Aug 2019 16:30:14 +0800 Subject: [PATCH 05/13] =?UTF-8?q?=E6=95=99=E5=AD=A6=E6=A1=88=E4=BE=8B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0tag?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20190830082934_add_tag_to_libraries.rb | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 db/migrate/20190830082934_add_tag_to_libraries.rb diff --git a/db/migrate/20190830082934_add_tag_to_libraries.rb b/db/migrate/20190830082934_add_tag_to_libraries.rb new file mode 100644 index 000000000..ea40cda5d --- /dev/null +++ b/db/migrate/20190830082934_add_tag_to_libraries.rb @@ -0,0 +1,5 @@ +class AddTagToLibraries < ActiveRecord::Migration[5.2] + def change + execute "insert into library_tags(name) values('企业案例')" + end +end From 884e96626d507c4bb65fbe82e5062fb6ccddabad Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 30 Aug 2019 16:34:17 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E9=A2=98=E5=BA=93=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_banks_controller.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/controllers/homework_banks_controller.rb b/app/controllers/homework_banks_controller.rb index a812da751..7e10509ba 100644 --- a/app/controllers/homework_banks_controller.rb +++ b/app/controllers/homework_banks_controller.rb @@ -11,7 +11,12 @@ class HomeworkBanksController < ApplicationController def update ActiveRecord::Base.transaction do - @bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer]) + if @bank.homework_type == 1 + @bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer]) + elsif @bank.homework_type == 3 + @bank.update_attributes(name: params[:name], description: params[:description], reference_answer: params[:reference_answer], + base_on_project: params[:base_on_project], min_num: params[:min_num], max_num: params[:max_num]) + end # 作业描述的附件 Attachment.associate_container(params[:attachment_ids], @bank.id, @bank.class) if params[:attachment_ids] From 6e09d178d82c3f098d814ebbba5486e2220d2621 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 30 Aug 2019 16:35:41 +0800 Subject: [PATCH 07/13] logger --- app/controllers/concerns/git_common.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/git_common.rb b/app/controllers/concerns/git_common.rb index 4bc566a05..1bb639472 100644 --- a/app/controllers/concerns/git_common.rb +++ b/app/controllers/concerns/git_common.rb @@ -47,7 +47,7 @@ module GitCommon def add_file @path, message, content = params[:path].strip, params[:message], params[:content] author_name, author_email = current_user.real_name, current_user.git_mail - Logger.info("...repo_path is #{@repo_path}") + Logger.info(" good repo_name is #{@repo_path}") @content = GitService.update_file(repo_path: @repo_path, file_path: @path, message: message, From f7430b589153f4d734c9fa2a32320946a755c605 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 30 Aug 2019 16:37:12 +0800 Subject: [PATCH 08/13] logger --- app/controllers/concerns/git_common.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/concerns/git_common.rb b/app/controllers/concerns/git_common.rb index 1bb639472..b8b2ec10a 100644 --- a/app/controllers/concerns/git_common.rb +++ b/app/controllers/concerns/git_common.rb @@ -47,7 +47,7 @@ module GitCommon def add_file @path, message, content = params[:path].strip, params[:message], params[:content] author_name, author_email = current_user.real_name, current_user.git_mail - Logger.info(" good repo_name is #{@repo_path}") + Rails.logger.info(" good repo_name is #{@repo_path}") @content = GitService.update_file(repo_path: @repo_path, file_path: @path, message: message, From ac840b3c944fbc559a83b3cd95cb65d64e56cac1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 30 Aug 2019 16:39:52 +0800 Subject: [PATCH 09/13] Merge branches 'dev_Ysl' and 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl # Conflicts: # public/react/src/modules/courses/Index.js --- public/react/src/modules/courses/poll/PollNew.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 0f1e810ab..531d9b3b8 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2455,7 +2455,7 @@ class PollNew extends Component { // console.log(this.state.projects===undefined?"":this.state.projects.poll_questions) var displaymysave = (mysave === true) ? "" : "display:none;"; return ( -
+
{/*提示*/} {Modalstype && Modalstype === true ? : ""} -
+ +

this.gotohome()}>{this.props.coursedata.name} > From 4f6c5b4264613c220c9e680eec97c50287ff2c8b Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Fri, 30 Aug 2019 16:48:52 +0800 Subject: [PATCH 10/13] add file --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index e86c135e1..3dc27edc6 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -13,7 +13,7 @@ class ShixunsController < ApplicationController before_action :shixun_access_allowed, except: [:index, :new, :create, :menus, :get_recommend_shixuns, :add_file, :propaedeutics, :departments, :apply_shixun_mirror, :get_mirror_script, :download_file] - before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy] + before_action :find_repo_name, only: [:repository, :commits, :file_content, :update_file, :shixun_exec, :copy, :add_file] before_action :allowed, only: [:update, :close, :update_propaedeutics, :settings, :publish, :shixun_members_added, :change_manager, :collaborators_delete, From f5ca57a544e85064cebbe67e6bf7d9ee372ee7b9 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 30 Aug 2019 17:07:24 +0800 Subject: [PATCH 11/13] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E6=B4=BB=E8=B7=83?= =?UTF-8?q?=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/courses_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index 1632813ea..b99cac96a 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1100,13 +1100,19 @@ class CoursesController < ApplicationController def export_member_act_score search = params[:search] ? "#{params[:search].strip}" : "" #用户名或学生学号id搜索 group_id = params[:group_id] #分班的班级id - @all_members = student_act_score group_id, search + @all_members = @course.students + @all_members = @all_members.where(course_group_id: group_id) unless group_id.blank? + unless search.blank? + @all_members = @all_members.joins(user: [:user_extension]).where('concat(users.lastname, users.firstname) like ? or user_extensions.student_id like ?',"%#{search}%","%#{search}%") + end + if @all_members.size == 0 normal_status(-1,"课堂暂时没有学生") elsif params[:export].present? && params[:export] normal_status(0,"正在下载中") else set_export_cookies + @all_members = student_act_score group_id, search act_score_to_xlsx(@all_members) filename_ = "#{current_user.real_name}_#{@course.name}_活跃度_#{Time.now.strftime('%Y%m%d_%H%M%S')}" render xlsx: "#{format_sheet_name filename_.strip}",template: "courses/export_member_act_score.xlsx.axlsx", From 6afafd04ef3a42e5cb7e93af97affa75a0913d97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 30 Aug 2019 17:22:27 +0800 Subject: [PATCH 12/13] Merge branches 'dev_Ysl' and 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into dev_Ysl # Conflicts: # public/react/src/modules/user/usersInfo/banks/BanksIndex.js --- .../react/src/modules/courses/poll/PollNew.js | 49 +++++++++++-------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 531d9b3b8..83f2477dc 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2123,6 +2123,12 @@ class PollNew extends Component { //最小值 HandleGradationGroupChangee = (value, index, max, length) => { + console.log("最小值"); + console.log(value); + console.log(index); + console.log(max); + console.log(length); + // debugger var minbool = false; var maxbool = false; @@ -2137,7 +2143,7 @@ class PollNew extends Component { if (minbool === true && maxbool === true) { for (var i = 0; i < arr.length; i++) { if (index === i) { - arr[i].question.min_choices = parseInt(value); + arr[i].question.min_choices = parseInt(value); } } this.setState({ @@ -2146,18 +2152,8 @@ class PollNew extends Component { } else { for (var i = 0; i < arr.length; i++) { if (index === i) { - try { - if(parseInt(value)===0){ - arr[i].question.min_choices = 2; - arr[i].question.max_choices = length; - }else{ arr[i].question.min_choices = parseInt(value); - arr[i].question.max_choices = max; - } - }catch (e) { - arr[i].question.min_choices = 2; - arr[i].question.max_choices = length; - } + arr[i].question.max_choices = length; break; } } @@ -2169,19 +2165,32 @@ class PollNew extends Component { } //最大值 - HandleGradationGroupChangeee = (value, index,minchoices) => { + HandleGradationGroupChangeee = (value, index,minchoices,length) => { // console.log("2112"); // console.log(value); // console.log(minchoices); + console.log("最大值"); + console.log(value); + console.log(index); + console.log(minchoices); + console.log(length); let arr = this.state.adddom; for (var i = 0; i < arr.length; i++) { if (index === i) { if(parseInt(value)===0&&parseInt(minchoices)===0){ + arr[i].question.min_choices= parseInt(0); + arr[i].question.max_choices = parseInt(0); + }else if(parseInt(minchoices)===0){ + arr[i].question.min_choices= parseInt(2); + arr[i].question.max_choices = parseInt(value); + } + else if(parseInt(value)===0&&parseInt(minchoices)>0){ arr[i].question.min_choices= parseInt(minchoices); arr[i].question.max_choices = parseInt(value); - }else { + } + else { arr[i].question.min_choices= minchoices===null?2:minchoices===undefined?2:minchoices===0?2:parseInt(minchoices); - arr[i].question.max_choices = parseInt(value); + arr[i].question.max_choices = parseInt(value); } } } @@ -2874,7 +2883,7 @@ class PollNew extends Component { value={itemo.question.min_choices === 0 || itemo.question.min_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.min_choices} > - + {itemo.question.answers === undefined ? "" : itemo.question.answers.map((itemt, indext) => { return ( indext >= 1 ? : "" @@ -2885,10 +2894,10 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/} this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices)} + onChange={(value) => this.HandleGradationGroupChangeee(value, indexo,itemo.question.min_choices,itemo.question.answers.length)} value={itemo.question.max_choices === 0 || itemo.question.max_choices === "0" ? "--" : itemo.question.min_choices === null ? "--" : itemo.question.min_choices === undefined ? "--" : itemo.question.max_choices} > @@ -3380,7 +3389,7 @@ class PollNew extends Component { className="ml10 mr10 color-grey-6 lineh-40 fl">~ {/*可选最大*/}