From 59cdede9249c773ee3450f860c049e8611ef0750 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 23 Jul 2019 18:39:31 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E9=9A=90=E8=97=8F=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_logined_header.html.erb | 2 +- app/views/layouts/_unlogin_header.html.erb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 071e272d..0277fe05 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -86,7 +86,7 @@ diff --git a/app/views/layouts/_unlogin_header.html.erb b/app/views/layouts/_unlogin_header.html.erb index 822bca84..6a641ea4 100644 --- a/app/views/layouts/_unlogin_header.html.erb +++ b/app/views/layouts/_unlogin_header.html.erb @@ -72,7 +72,7 @@ From ba427295c3ece3557890f3652b7c25af3d8ee6e6 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 23 Jul 2019 18:51:13 +0800 Subject: [PATCH 02/30] =?UTF-8?q?=E8=B0=83=E6=95=B4footer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/layouts/_footer.html.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/views/layouts/_footer.html.erb b/app/views/layouts/_footer.html.erb index 04bb288b..1f463345 100644 --- a/app/views/layouts/_footer.html.erb +++ b/app/views/layouts/_footer.html.erb @@ -1,10 +1,10 @@
- 登录 + 登录 - 登录 + 注册 <%#= link_to '注册', user_join_path, :class => "ml5 color-white" %>
diff --git a/app/views/welcome/join_private_courses.js.erb b/app/views/welcome/join_private_courses.js.erb new file mode 100644 index 00000000..35214ee0 --- /dev/null +++ b/app/views/welcome/join_private_courses.js.erb @@ -0,0 +1,2 @@ +var htmlvalue = "<%= escape_javascript(render :partial => 'courses/join_private_course') %>"; +pop_box_new(htmlvalue,460,220); \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 9ab407ee..1df0c29c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1670,7 +1670,6 @@ RedmineApp::Application.routes.draw do ## oauth相关 get 'html_show' get 'switch_user_module' get 'reward_grade' - match 'join_private_courses', :via => [:get, :post] end member do @@ -2606,6 +2605,7 @@ RedmineApp::Application.routes.draw do ## oauth相关 ######################## ##added by wen########## #######confusing######## + match 'welcome/join_private_courses', to: 'welcome#join_private_courses', :via => [:get, :post], :as => 'join_private_courses' get 'welcome/search', to: 'welcome#search' get 'school/index', to: 'school#index' get 'school/:school_id', to: From 737dbdd3415482fe03a8bcaf56dd38792bf21fe3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 10:27:20 +0800 Subject: [PATCH 06/30] b --- Gemfile | 4 ++-- public/react/src/modules/tpm/NewHeader.js | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index d89f9a24..ac45f360 100644 --- a/Gemfile +++ b/Gemfile @@ -64,8 +64,8 @@ gem 'elasticsearch-rails' gem 'oauth2' # xlsx -gem 'axlsx', '3.0.0.pre' -gem 'axlsx_rails', '0.3.0' +# gem 'axlsx', '3.0.0.pre' +# gem 'axlsx_rails', '0.3.0' # state machine gem 'aasm' diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 649fd651..024a9fb5 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -291,7 +291,8 @@ class NewHeader extends Component { - // console.log(match.path) + console.log(this.props.current_user) + console.log(this.state.current_user) // console.log(match.path.startsWith("/ec_courses")) return (
From a60f4332b33247749e5dbb0b28f046639f085676 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Wed, 24 Jul 2019 10:59:17 +0800 Subject: [PATCH 07/30] =?UTF-8?q?react=E5=A4=B4=E9=83=A8=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 4 ++-- public/react/src/modules/tpm/NewHeader.js | 27 ++++++++++++++++++----- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index ac45f360..d89f9a24 100644 --- a/Gemfile +++ b/Gemfile @@ -64,8 +64,8 @@ gem 'elasticsearch-rails' gem 'oauth2' # xlsx -# gem 'axlsx', '3.0.0.pre' -# gem 'axlsx_rails', '0.3.0' +gem 'axlsx', '3.0.0.pre' +gem 'axlsx_rails', '0.3.0' # state machine gem 'aasm' diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 024a9fb5..0281a285 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -257,6 +257,23 @@ class NewHeader extends Component { localStorage.setItem('competition_uid', true); } + NewCoursesAndShixuns=(sum)=>{ + if(this.props.current_user&&this.props.current_user.login=== ""){ + window.location.href = "/login"; + }else{ + if(sum===1){ + window.location.href = "/courses/new"; + }else if(sum===2){ + window.location.href = "/shixuns/new"; + }else if(sum===3){ + window.location.href = "/paths/new"; + }else if(sum===4){ + window.location.href = "/projects/new"; + } + } + + } + render() { let {careerslist,isLogin,current_user,ImageUrl,ecUrl,ImageUrlType,project_packages_url} = this.state; // const isLogin = isLogintype; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 @@ -291,7 +308,7 @@ class NewHeader extends Component { - console.log(this.props.current_user) + console.log(this.props.current_user&&this.props.current_user.login=== "") console.log(this.state.current_user) // console.log(match.path.startsWith("/ec_courses")) return ( @@ -460,10 +477,10 @@ class NewHeader extends Component {
  • From 0cd61133a791ebfa3c0b74df52713ef1881bab78 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Wed, 24 Jul 2019 11:28:25 +0800 Subject: [PATCH 08/30] modify competition --- app/views/competitions/_qg_second_opensource.html.erb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/views/competitions/_qg_second_opensource.html.erb b/app/views/competitions/_qg_second_opensource.html.erb index 193e4d1c..8aef0390 100644 --- a/app/views/competitions/_qg_second_opensource.html.erb +++ b/app/views/competitions/_qg_second_opensource.html.erb @@ -17,6 +17,7 @@ first_stage = @competition.competition_stages.first first_section = first_stage.competition_stage_sections.first first_entry = first_section.competition_entries.first + second_entry = first_section.competition_entries.second is_start = Time.now > first_section.start_time competition_url = User.current.logged? ? "#{first_entry.url}?eid=#{User.current.id}" : "#{first_entry.url}" btn_url = is_start ? "#{competition_url}" : "javascript:void(0);" @@ -44,8 +45,8 @@ user_enrolled = false invite_code = nil - if first_entry.url.present? - course_id = first_entry.url.split('/')[-5, 1] + if first_entry.url.present? && second_entry.url.present? + course_id = second_entry.url course = Course.find_by_id(course_id) if course.present? && @user && @user.logged? From ff7b69577861f465df7eed5907f3578fc18d4f8f Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Wed, 24 Jul 2019 15:12:19 +0800 Subject: [PATCH 09/30] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E9=A1=B5=E9=9D=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index b1eee18d..98b58614 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -3,7 +3,7 @@ class ManagementsController < ApplicationController before_filter :require_business before_filter :require_admin, :only => [:shixun_setting_list, :mirror_repository, :mirror_picture_shixuns, :editmd_template, :editmd_template, :subject_level_system, :subject_setting_list, - :shixun_authorization, :ec_template, :codemirror_template, :update_user, + :shixun_authorization, :ec_template, :codemirror_template, :course_guide_template, :shixun_quality_score, :tech_system, :update_notice, :setting_banner, :training_2018, :create_standard] layout 'base_management' From 10aeb133938b18d9e66edc73de75a0f1bff60c37 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 16:38:17 +0800 Subject: [PATCH 10/30] =?UTF-8?q?=E6=97=A7=E7=89=88=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E6=9C=89=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index aac2a843..c1943d10 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -629,7 +629,7 @@ module ApplicationHelper end =end user_e = UserExtensions.where(:user_id => User.current.id).first - if User.current.lastname.blank? || user_e.school_id.blank? || user_e.identity.blank? || User.current.mail.blank? + if User.current.profile_completed? redirect_to my_account_path Rails.logger.info("check_authentication end") elsif User.current.certification != 1 # 系统没有授权 From 986efd68dbdc98b8dc3c0262857a55adac11bf61 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 16:46:30 +0800 Subject: [PATCH 11/30] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=B5=84=E6=96=99?= =?UTF-8?q?=E5=90=8E=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c1943d10..8aa3b400 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -629,7 +629,7 @@ module ApplicationHelper end =end user_e = UserExtensions.where(:user_id => User.current.id).first - if User.current.profile_completed? + if !User.current.profile_completed? redirect_to my_account_path Rails.logger.info("check_authentication end") elsif User.current.certification != 1 # 系统没有授权 From 110a915e9ca683fc16c9785d955660cc97d4d42a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 24 Jul 2019 16:50:03 +0800 Subject: [PATCH 12/30] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 8aa3b400..5737f99b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -628,7 +628,6 @@ module ApplicationHelper return end =end - user_e = UserExtensions.where(:user_id => User.current.id).first if !User.current.profile_completed? redirect_to my_account_path Rails.logger.info("check_authentication end") From 81db4df748efab27dd4513719d0c482ae8b380bc Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 25 Jul 2019 10:14:51 +0800 Subject: [PATCH 13/30] =?UTF-8?q?=E7=AB=9E=E8=B5=9B-=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=87=E6=B3=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_gq_second_code_competition.html.erb | 40 ++++++++++++++++++- public/stylesheets/educoder/edu-all.css | 4 +- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/app/views/competitions/_gq_second_code_competition.html.erb b/app/views/competitions/_gq_second_code_competition.html.erb index 9097eccf..02847743 100644 --- a/app/views/competitions/_gq_second_code_competition.html.erb +++ b/app/views/competitions/_gq_second_code_competition.html.erb @@ -34,8 +34,44 @@ link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476' }, ], - [{},{},{}], - [{},{},{}] + [{ + name: 'Java项目', + description: "CoreNLP是一个Java自然语言分析库,是斯坦福大学自然语言处理小组的研究成果,它集成了所有的自然语言处理工具:分词、词性标注、依存句法分析、命名实体识别等。

    本项目的stanford/nlp/parser/目录中包含了Lexparser、nndep以及Shiftreduce等句法分析算法的Java实现。", + task: '标注../stanford/nlp/parser/目录下的所有代码文件(包括子目录)。', + link_name: 'CSDN, 使用Stanford Parser进行句法分析', + link_url: 'https://blog.csdn.net/u010239102/article/details/78111760' + },{ + name: 'C++项目', + description: "Sentencepiece是Google公司开发的一个C++自然语言处理工具包,它实现了数据驱动、跨语言、高性能、轻量级的面向神经网络文本生成系统的无监督文本词条化工具。

    本项目的src/目录中包含了BPE、Unigram以及Char等文本分词算法的C++实现。", + task: '标注../src/目录下的所有.cc和.h代码文件(不包括子目录)。(注:其中模型训练、测试相关代码可以去掉:*_test.cc, *_trainer.cc, *_trainer.h)', + link_name: 'CSDN, sentencePiece入门小结', + link_url: 'https://blog.csdn.net/sinat_33455447/article/details/90265938' + },{ + name: 'Python项目', + description: "NLTK是宾西法尼亚大学计算机和信息科学系开发的一个Python自然语言处理工具包,它提供了易于使用的接口,通过这些接口可以访问超过50个语料库和词汇资源(如WordNet),还有一套用于分类、标记化、词干标记、解析和语义推理的文本处理库。

    本项目的nltk/stem/目录中包含了Lancaster、Porter以及Snowball等文本分词算法的Python实现。", + task: '标注../nltk/stem/目录下的所有代码文件。', + link_name: 'CSDN, 英文分词的算法和原理', + link_url: 'https://blog.csdn.net/wisdom77/article/details/79446674' + }], + [{ + name: 'Java项目', + description: "Deeplearning4j是Eclipse公司开发的支持各种深度学习算法的运算框架,它可以实施的技术包括受限玻尔兹曼机、深度置信网络、深度自动编码器、堆叠式降噪自动编码器、循环神经张量网络,以及word2vec、doc2vec和GloVe等。

    本项目的nn/layers/recurrent/目录中包含了循环神经网络RNN中LSTM、Bidirectional LSTM等算法的Java实现。", + task: '标注../nn/layers/recurrent/目录下的所有代码文件。', + link_name: '官方,DL4J快速入门指南', + link_url: 'https://deeplearning4j.org/cn/quickstart' + },{ + name: 'C++项目', + description: "TensorFlow是谷歌人工智能团队开发的用于机器学习和深度神经网络研究的开源框架,它在图形分类、音频处理、推荐系统和自然语言处理等场景下都有丰富的应用,提供了丰富的API,包括基本的向量矩阵计算、各种优化算法、各种卷积神经网络和循环神经网络基本单元的实现、以及可视化的辅助工具等。

    本项目的core/kernels/rnn/目录中包含了循环神经网络RNN中卷积GEMM、LSTM以及GRU算法的C++实现。", + task: '标注../core/kernels/rnn/目录下的所有代码文件。', + link_name: 'CSDN, 深度学习之RNN(循环神经网络)', + link_url: 'https://blog.csdn.net/qq_32241189/article/details/80461635' + },{ + name: 'Python项目', + description: "Keras是Google公司开发的高度模块化的神经网络学习框架,它是一个高层神经网络API,能够支持简易和快速的原型设计,支持CNN和RNN或二者的结合,且能够支持无缝CPU和GPU切换。

    本项目的keras/layers/目录中包含了神经网络运算层中Embedding、CNN以及RNN等算法的Python实现。", + task: '标注../keras/layers/目录下的所有代码文件。', + link_name: '官方, Keras说明文档', + link_url: 'https://keras.io/layers/about-keras-layers/' + }] ] %> diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index e013221c..be84a7dc 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -657,8 +657,8 @@ a.enterLink{cursor: pointer;color: #418CCD!important;background: none!important; .second_code_1{min-height: 791px;} .second_code_2{min-height: 436px;} .second_code_3{min-height: 1460px;padding-top: 190px;box-sizing: border-box;position: relative} -.second_code_4{min-height: 724px;padding-top: 190px;box-sizing: border-box;position: relative} -.second_code_5{min-height: 718px;padding-top: 190px;box-sizing: border-box;position: relative} +.second_code_4{min-height: 1459px;padding-top: 190px;box-sizing: border-box;position: relative} +.second_code_5{min-height: 1464px;padding-top: 190px;box-sizing: border-box;position: relative} .second_code_6{min-height: 1060px;} .second_code_7{min-height: 1116px;} .second_code_8{min-height: 711px;} From 3227be8a7c6ce0d4e329de01dfe85ef1626624c6 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 25 Jul 2019 10:18:05 +0800 Subject: [PATCH 14/30] newmain:padding-bottom --- public/stylesheets/educoder/edu-main.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/stylesheets/educoder/edu-main.css b/public/stylesheets/educoder/edu-main.css index c46f94bd..87fd616b 100644 --- a/public/stylesheets/educoder/edu-main.css +++ b/public/stylesheets/educoder/edu-main.css @@ -192,7 +192,7 @@ input::-ms-clear{display:none;} .newContainer{ min-height:100%; height: auto !important; height: 100%; /*IE6不识别min-height*/position: relative;} .educontent{width: 1200px;margin:0px auto;box-sizing: border-box}/*中间部分宽度固定为1200*/ .newMain{ margin: 0 auto; padding-bottom: 235px; min-width:1200px;padding-top: 60px}/*padding-bottom根据底部的高度而定*/ -.newMain{ padding-bottom: 120px !important; } +.newMain{ padding-bottom: 110px !important; } /*高度*/ .height-100{height: 100%;} From 4b88683b8426eb194ecd90ec09a66c91ac4d2034 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Thu, 25 Jul 2019 10:32:22 +0800 Subject: [PATCH 15/30] set profile completed false when delete school apply && fix agree identity auth --- app/controllers/managements_controller.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 98b58614..623268d2 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1661,7 +1661,7 @@ end # 删除单位 def delete_school school = School.where(:id => params[:school]).first - UserExtensions.where(:school_id => params[:school]).update_all(:school_id => nil, :department_id => nil) + UserExtensions.where(:school_id => params[:school]).update_all(school_id: nil, department_id: nil, profile_completed: false) ApplyAddSchools.where(:school_id => params[:school]).destroy_all ApplyAddDepartment.where(:school_id => params[:school]).destroy_all school.destroy @@ -1752,7 +1752,7 @@ end Tiding.create(:user_id => applied_department.user_id, :trigger_user_id => 0, :container_id => applied_department.id, :container_type =>'ApplyAddDepartment', :belong_container_id => applied_department.department.school_id, :belong_container_type=> 'School', :tiding_type => "System", :status => 2, :extra => params[:reason]) # 删除学校的用户 users = UserExtensions.where("department_id = #{applied_department.department_id}") - users.update_all(:department_id => nil) + users.update_all(department_id: nil, profile_completed: false) applied_department.department.destroy # 已审批删除 elsif params[:tip] == "applied" @@ -3692,7 +3692,7 @@ end diskfile1 = disk_filename("UserAuthentication", apply_user.user_id) +"ID" apply_user.update_attributes(:is_delete => true) - File.delete(diskfile1) + File.delete(diskfile1) if File.exist?(diskfile1) =begin begin From 5335ab2c7cc33bd87491d6fc396072e7b8b45724 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Thu, 25 Jul 2019 10:58:43 +0800 Subject: [PATCH 16/30] =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=90=E5=8D=95=E4=BD=8D=E6=97=A0=E6=B3=95=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E6=96=B0=E6=B7=BB=E5=8A=A0=E7=9A=84=E5=AD=A6=E6=A0=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/school_controller.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/controllers/school_controller.rb b/app/controllers/school_controller.rb index 1ecd5733..251400d5 100644 --- a/app/controllers/school_controller.rb +++ b/app/controllers/school_controller.rb @@ -126,21 +126,26 @@ class SchoolController < ApplicationController chinese << char end end + if pinyin.size > 0 + search_str = "name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'" + else + search_str = "name like '%#{chinese.join("")}%'" + end if params[:no_school_ids] if(condition == '') @school = School.where("id not in #{params[:no_school_ids]}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100) @school_count = School.count else - @school = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100) - @school_count = School.where("id not in #{params[:no_school_ids]} and name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count + @school = School.where("id not in #{params[:no_school_ids]} and #{search_str}").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100) + @school_count = School.where("id not in #{params[:no_school_ids]} and #{search_str}").count end else if(condition == '') @school = School.reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100) @school_count = School.count else - @school = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100) - @school_count = School.where("name like '%#{chinese.join("")}%' and pinyin like '%#{pinyin.join("")}%'").count + @school = School.where(search_str).reorder('CONVERT (name USING gbk) COLLATE gbk_chinese_ci asc').page((params[:page].to_i || 1)).per(100) + @school_count = School.where(search_str).count end end From ac54319542a8487e3cc95efb827edc1767b8402d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 Jul 2019 14:02:44 +0800 Subject: [PATCH 17/30] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E9=A1=B5=E9=9D=A2=E5=A2=9E=E5=8A=A0=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=91=98=E7=9A=84=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 3 +++ app/views/managements/update_user.html.erb | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 98b58614..83bee45d 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -220,6 +220,9 @@ class ManagementsController < ApplicationController @user.nickname = params[:nickname] @user.lastname = params[:lastname] @user.business = params[:business].to_i + if params[:admin] + @user.admin = params[:admin].to_i + end @user.firstname = "" @user.mail = params[:mail].strip == "" ? nil : params[:mail] @user.phone = params[:phone].strip == "" ? nil : params[:phone] diff --git a/app/views/managements/update_user.html.erb b/app/views/managements/update_user.html.erb index 4ef8e9e6..af1c59c0 100644 --- a/app/views/managements/update_user.html.erb +++ b/app/views/managements/update_user.html.erb @@ -190,6 +190,14 @@ name="business" value="<%= @user.business? ? "1" : "0" %>" id="person_business" class="magic-checkbox" style="float:left; margin-top: 8px;"> + <% if User.current.admin? %> + + + name="admin" value="<%= @user.admin? ? "1" : "0" %>" id="person_admin" class="magic-checkbox" style="float:left; margin-top: 8px;"> + + + <% end %> +
  • @@ -625,7 +633,14 @@ }else{ document.getElementById('person_business').value = "0"; } - + <% if User.current.admin? %> + var admin_check = document.getElementById('person_admin').checked; + if (admin_check) { + document.getElementById('person_admin').value = "1"; + } else { + document.getElementById('person_admin').value = "0"; + } + <% end %> my_account_form_submit(); }); function my_account_form_submit(){ From 84a1acf9174792781442b259d1c881fd649e24f5 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 25 Jul 2019 17:42:49 +0800 Subject: [PATCH 18/30] =?UTF-8?q?=E7=AB=9E=E8=B5=9B-=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=87=E6=B3=A8=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/_gq_second_code_competition.html.erb | 6 +++++- public/stylesheets/educoder/edu-all.css | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/views/competitions/_gq_second_code_competition.html.erb b/app/views/competitions/_gq_second_code_competition.html.erb index 02847743..7eb0865d 100644 --- a/app/views/competitions/_gq_second_code_competition.html.erb +++ b/app/views/competitions/_gq_second_code_competition.html.erb @@ -120,7 +120,11 @@

    项目简介

    <%= raw row_data[:description] %>

    标注任务

    -

    <%= row_data[:task] %>

    + <% if index ==2 %> +

    <%= row_data[:task] %>

    + <% else %> +

    <%= row_data[:task] %>

    + <% end %>

    经典算法解读:

      <%= row_data[:link_name] %> diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 09d24d8d..28989a5b 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -712,7 +712,7 @@ li.challenge_box{ color: #0B8298;font-size: 20px;line-height: 20px;text-align: left;font-weight: bold;margin-bottom: 40px;padding-left: 3px; } .challenge_b_des{ - line-height: 20px;color: #0B8298;font-size: 18px;text-align: left;text-align:justify;margin-bottom: 40px;min-height: 220px; + line-height: 20px;color: #0B8298;font-size: 18px;text-align: left;text-align:justify;margin-bottom: 30px;min-height: 240px; } li.challenge_box:last-child{ margin-right: 0px; From 08575044f56003883a2ea7f8e902f4164850e0d7 Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Thu, 25 Jul 2019 17:58:05 +0800 Subject: [PATCH 19/30] =?UTF-8?q?=E7=AB=9E=E8=B5=9B-=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E6=A0=87=E6=B3=A8=E7=BB=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/competitions/_gq_second_code_competition.html.erb | 5 +---- public/stylesheets/educoder/edu-all.css | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/views/competitions/_gq_second_code_competition.html.erb b/app/views/competitions/_gq_second_code_competition.html.erb index 7eb0865d..0baf1fe4 100644 --- a/app/views/competitions/_gq_second_code_competition.html.erb +++ b/app/views/competitions/_gq_second_code_competition.html.erb @@ -82,10 +82,7 @@ second_section = stage.competition_stage_sections[1] %>
      "> - <% if i.zero? %> -

      <%= stage.name %>

      - <% end %> - +

      <%= stage.name %>

      • <%= first_section.try(:name) %> diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 28989a5b..7b4d9814 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -709,7 +709,7 @@ li.challenge_box{ font-size: 30px;color: #0E8B87;line-height: 30px;margin-bottom: 30px; } .challenge_b_d{ - color: #0B8298;font-size: 20px;line-height: 20px;text-align: left;font-weight: bold;margin-bottom: 40px;padding-left: 3px; + color: #0B8298;font-size: 20px;line-height: 20px;text-align: left;font-weight: bold;margin-bottom: 30px;padding-left: 3px; } .challenge_b_des{ line-height: 20px;color: #0B8298;font-size: 18px;text-align: left;text-align:justify;margin-bottom: 30px;min-height: 240px; @@ -718,7 +718,7 @@ li.challenge_box:last-child{ margin-right: 0px; } .algorithm{margin-bottom: 40px;} -.algorithm a{display: block;text-align: left;color: #23A8FD;position: relative;float: left;font-size: 18px;line-height: 22px;} +.algorithm a{display: block;text-align: left;color: #23A8FD;position: relative;float: left;font-size: 17px;line-height: 22px;} .algorithm a:after{position: absolute;left: 0px;bottom: -2px;background:#23A8FD;width: 100%;height: 1px;content: ''; } From 8227a14960b4ccf91bc0c61a446819f68110d82f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 Jul 2019 18:32:11 +0800 Subject: [PATCH 20/30] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AD=A6=E6=A0=A1?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E9=9C=80=E8=A6=81=E9=87=8D=E6=96=B0=E5=AE=8C?= =?UTF-8?q?=E5=96=84=E8=B5=84=E6=96=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index e3d560aa..980c775b 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1664,7 +1664,8 @@ end # 删除单位 def delete_school school = School.where(:id => params[:school]).first - UserExtensions.where(:school_id => params[:school]).update_all(school_id: nil, department_id: nil, profile_completed: false) + UserExtensions.where(:school_id => params[:school]).update_all(school_id: nil, department_id: nil) + User.joins(:user_extension).where(user_extensions: {school_id: params[:school]}).update_all(profile_completed: false) ApplyAddSchools.where(:school_id => params[:school]).destroy_all ApplyAddDepartment.where(:school_id => params[:school]).destroy_all school.destroy From e0a18f44f81f7725ab940ca8fcf6d35646a97337 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 Jul 2019 18:42:26 +0800 Subject: [PATCH 21/30] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AD=A6=E6=A0=A1?= =?UTF-8?q?=E5=BA=94=E8=AF=A5=E6=9B=B4=E6=96=B0=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/managements_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/managements_controller.rb b/app/controllers/managements_controller.rb index 980c775b..bfd4b8be 100644 --- a/app/controllers/managements_controller.rb +++ b/app/controllers/managements_controller.rb @@ -1870,6 +1870,7 @@ end # 删除学校的用户 users = UserExtensions.where("school_id = #{applied_school.school_id}") + User.where(id: users.map(&:user_id)).update_all(profile_completed: false) # 申请了职业认证的用户撤销申请 apply_user_auth = ApplyUserAuthentication.where(:user_id => users.map(&:user_id), :auth_type => 2, :status => 0) From c575fdf8cfcbf0cc735f65f05cd8ff71e1e41d56 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 Jul 2019 21:09:34 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8A=9F=E8=83=BD=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/managements/update_user.html.erb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/views/managements/update_user.html.erb b/app/views/managements/update_user.html.erb index af1c59c0..fab25083 100644 --- a/app/views/managements/update_user.html.erb +++ b/app/views/managements/update_user.html.erb @@ -641,6 +641,7 @@ document.getElementById('person_admin').value = "0"; } <% end %> + console.log("######" + document.getElementById('person_admin')); my_account_form_submit(); }); function my_account_form_submit(){ From 80782efab6d937e6939ff8688d470b7107c10644 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 Jul 2019 21:14:13 +0800 Subject: [PATCH 23/30] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/managements/update_user.html.erb | 1 - 1 file changed, 1 deletion(-) diff --git a/app/views/managements/update_user.html.erb b/app/views/managements/update_user.html.erb index fab25083..af1c59c0 100644 --- a/app/views/managements/update_user.html.erb +++ b/app/views/managements/update_user.html.erb @@ -641,7 +641,6 @@ document.getElementById('person_admin').value = "0"; } <% end %> - console.log("######" + document.getElementById('person_admin')); my_account_form_submit(); }); function my_account_form_submit(){ From ead4437aae663aa8293313e48c87e349151e336a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 26 Jul 2019 09:47:28 +0800 Subject: [PATCH 24/30] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E5=91=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/managements/update_user.html.erb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/views/managements/update_user.html.erb b/app/views/managements/update_user.html.erb index af1c59c0..d288c7fb 100644 --- a/app/views/managements/update_user.html.erb +++ b/app/views/managements/update_user.html.erb @@ -193,9 +193,10 @@ <% if User.current.admin? %> - name="admin" value="<%= @user.admin? ? "1" : "0" %>" id="person_admin" class="magic-checkbox" style="float:left; margin-top: 8px;"> + id="person_admin" class="magic-checkbox" style="float:left; margin-top: 8px;"> + "> <% end %>
      • @@ -636,9 +637,9 @@ <% if User.current.admin? %> var admin_check = document.getElementById('person_admin').checked; if (admin_check) { - document.getElementById('person_admin').value = "1"; + document.getElementById('user_admin').value = "1"; } else { - document.getElementById('person_admin').value = "0"; + document.getElementById('user_admin').value = "0"; } <% end %> my_account_form_submit(); From d22f9c3f43b20e305463f8f7a379c0a8e88fc672 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 26 Jul 2019 10:17:03 +0800 Subject: [PATCH 25/30] competition team detail --- .../competition_teams_controller.rb | 41 +++++++++++++++++-- app/models/shixun.rb | 2 +- app/views/competition_teams/show.html.erb | 26 +++++++++--- 3 files changed, 60 insertions(+), 9 deletions(-) diff --git a/app/controllers/competition_teams_controller.rb b/app/controllers/competition_teams_controller.rb index 2bbbd6ef..72732a1a 100644 --- a/app/controllers/competition_teams_controller.rb +++ b/app/controllers/competition_teams_controller.rb @@ -17,7 +17,8 @@ class CompetitionTeamsController < ApplicationController @team_user_ids = @team.team_members.pluck(:user_id) - shixuns = Shixun.where(user_id: @team_user_ids, status: 2).where('shixuns.created_at > ?', Time.parse('2018-06-01')) + shixuns = Shixun.where(user_id: @team_user_ids, status: 2) + .where('shixuns.created_at > ? && shixuns.created_at <= ?', Time.parse('2018-06-01'), @competition.end_time) shixuns = shixuns.joins('left join shixuns forked_shixuns on forked_shixuns.fork_from = shixuns.id and forked_shixuns.status = 2') shixuns = shixuns.select('shixuns.id, shixuns.identifier, shixuns.user_id, shixuns.myshixuns_count, shixuns.name, shixuns.fork_from, sum(forked_shixuns.myshixuns_count) forked_myshixun_count') @shixuns = shixuns.group('shixuns.id').order('shixuns.myshixuns_count desc').includes(:creator) @@ -30,18 +31,30 @@ class CompetitionTeamsController < ApplicationController forked_myshixun_count_map = get_valid_myshixun_count(forked_shixun_map.keys) forked_myshixun_count_map.each { |k, v| @myshixun_count_map[forked_shixun_map[k]] += v } - # todo:使用新版course_members + @course_count_map = get_valid_course_count(shixun_ids) + forked_map = get_valid_course_count(forked_shixun_map.keys) + @forked_course_count_map = {} + forked_map.each do |forked_id, course_count| + @forked_course_count_map[forked_shixun_map[forked_id]] ||= 0 + @forked_course_count_map[forked_shixun_map[forked_id]] += course_count + end + + + # 课堂 course_ids = Course.where('courses.created_at > ?', Time.parse('2018-06-01')) + .where('courses.created_at <= ?', @competition.end_time) .joins('join course_members on course_members.course_id = courses.id and course_members.role in (1,2,3)') .where(course_members: { user_id: @team_user_ids }).pluck(:id) courses = Course.where(id: course_ids).joins(:shixun_homework_commons).where('homework_commons.publish_time < now()') @courses = courses.select('courses.id, courses.name, courses.members_count, count(*) shixun_homework_count') .group('courses.id').order('shixun_homework_count desc').having('shixun_homework_count > 0') + course_ids = @courses.map(&:id) @course_myshixun_map = Myshixun.joins(student_works: :homework_common) - .where(homework_commons: { course_id: @courses.map(&:id) }) + .where(homework_commons: { course_id: course_ids }) .where('exists(select 1 from games where games.myshixun_id = myshixuns.id and games.status = 2)') .group('homework_commons.course_id').count + @course_shixun_count_map = get_valid_shixun_count(course_ids) end def search_teacher @@ -345,6 +358,28 @@ class CompetitionTeamsController < ApplicationController .group('shixun_id').count end + def get_valid_course_count(ids) + percentage_sql = StudentWork.where('homework_common_id = homework_commons.id') + .select('count(compelete_status !=0 ) as finish, count(*) as total') + .having('finish > (total / 2)').to_sql + + Course.joins(shixun_homework_commons: :homework_commons_shixuns) + .where('shixun_id in (?)', ids) + .where("exists (#{percentage_sql})") + .group('shixun_id').count + end + + def get_valid_shixun_count(ids) + percentage_sql = StudentWork.where('homework_common_id = homework_commons.id') + .select('count(compelete_status !=0 ) as finish, count(*) as total') + .having('finish > (total / 2)').to_sql + Shixun.joins(homework_commons_shixuns: :homework_common) + .where(homework_commons: { homework_type: 3 }) + .where('course_id in (?)', ids) + .where("exists (#{percentage_sql})") + .group('course_id').count + end + def record_agent_user_action # 记录是否是引流用户的行为 ip = request.remote_ip diff --git a/app/models/shixun.rb b/app/models/shixun.rb index 0d201ed3..35193f2d 100644 --- a/app/models/shixun.rb +++ b/app/models/shixun.rb @@ -32,7 +32,7 @@ class Shixun < ActiveRecord::Base has_many :users, :through => :shixun_members has_many :shixun_members, :dependent => :destroy has_one :repository, :dependent => :destroy - has_many :homework_commons_shixunses + has_many :homework_commons_shixuns, class_name: 'HomeworkCommonsShixuns' has_many :homework_challenge_settings, :dependent => :destroy has_many :challenges, :dependent => :destroy has_many :myshixuns, :dependent => :destroy diff --git a/app/views/competition_teams/show.html.erb b/app/views/competition_teams/show.html.erb index 129fa32a..f8e1f1c5 100644 --- a/app/views/competition_teams/show.html.erb +++ b/app/views/competition_teams/show.html.erb @@ -20,11 +20,23 @@ <% total_myshixun_count = 0 total_forked_myshixun_count = 0 + total_shixun_score = 0 %> <% @shixuns.each do |shixun| %> <% total_myshixun_count += shixun.myshixuns_count total_forked_myshixun_count += shixun['forked_myshixun_count'].to_i + + valid_course_count = @course_count_map.fetch(shixun.id, 0) + valid_student_count = @myshixun_count_map.fetch(shixun.id, 0) + score = + if shixun.fork_from.blank? + 500 + 50 * valid_course_count + 10 * valid_student_count + else + 100 + 10 * valid_course_count + 5 * valid_student_count + end + score += @forked_course_count_map.fetch(shixun.id, 0) + total_shixun_score += score %> <%= shixun.creator.show_real_name %> @@ -39,7 +51,7 @@ <%= shixun.myshixuns_count.to_i.zero? ? '--' : shixun.myshixuns_count.to_i %> <%= shixun['forked_myshixun_count'].to_i.zero? ? '--' : shixun['forked_myshixun_count'].to_i %> <%= @myshixun_count_map.fetch(shixun.id, '--') %> - -- + <%= score.zero? ? '--' : score %> <% end %> @@ -50,7 +62,7 @@ <%= total_myshixun_count %> <%= total_forked_myshixun_count %> <%= @myshixun_count_map.values.reduce(:+) %> - -- + <%= total_shixun_score %> @@ -73,11 +85,15 @@ <% total_members_count = 0 total_shixun_homework_count = 0 + total_course_score = 0 %> <% @courses.each do |course| %> <% total_members_count += course.members_count.to_i total_shixun_homework_count += course['shixun_homework_count'].to_i + + score = 500 + 5 * @course_shixun_count_map.fetch(course.id, 0) * @course_myshixun_map.fetch(course.id, 0) + total_course_score += score %> <%= course.teachers.where(user_id: @team_user_ids).first.user.show_real_name %> @@ -89,7 +105,7 @@ <%= course.members_count %> <%= course['shixun_homework_count'].presence || '--' %> <%= @course_myshixun_map.fetch(course.id, '--') %> - -- + <%= score.zero? ? '--' : score %> <% end %> @@ -99,8 +115,8 @@ <%= @courses.size %> <%= total_members_count %> <%= total_shixun_homework_count %> - <%= @course_myshixun_map.values.reduce(:+) %> - -- + <%= @course_myshixun_map.values.reduce(:+) || 0 %> + <%= total_course_score %> From 2c4ce7e049eaa70bbc2b016420e0438f1f8e1b5a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 26 Jul 2019 10:24:48 +0800 Subject: [PATCH 26/30] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E7=9A=84=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5737f99b..6a62503e 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -628,17 +628,19 @@ module ApplicationHelper return end =end - if !User.current.profile_completed? - redirect_to my_account_path - Rails.logger.info("check_authentication end") - elsif User.current.certification != 1 # 系统没有授权 - day_cer = UserDayCertification.where(:user_id => User.current.id).last - unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 - redirect_to my_account_path - Rails.logger.info("check_authentication end") - return - end - end + + # 暂时不需要试用授权 + # if !User.current.profile_completed? + # redirect_to my_account_path + # Rails.logger.info("check_authentication end") + # elsif User.current.certification != 1 # 系统没有授权 + # day_cer = UserDayCertification.where(:user_id => User.current.id).last + # unless (Time.now.to_i - day_cer.try(:created_at).to_i) < 86400 + # redirect_to my_account_path + # Rails.logger.info("check_authentication end") + # return + # end + # end end def match_specific_symbol(str) From a264ce6ea24af5965c832f0832a700c48175117d Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 26 Jul 2019 10:52:53 +0800 Subject: [PATCH 27/30] add user profile completed check --- app/controllers/libraries_controller.rb | 2 ++ app/controllers/project_packages_controller.rb | 5 +++-- .../competitions/_qg_second_opensource.html.erb | 13 +++++++++++++ app/views/competitions/enroll.html.erb | 16 ++++++++++++++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/app/controllers/libraries_controller.rb b/app/controllers/libraries_controller.rb index ac861841..a1e8a56c 100644 --- a/app/controllers/libraries_controller.rb +++ b/app/controllers/libraries_controller.rb @@ -1,7 +1,9 @@ class LibrariesController < ApplicationController + include ApplicationHelper layout 'base_library' before_filter :require_login, :except => [:index, :show] + before_filter :check_authentication, except: [:index, :show] after_filter :increment_visit_count, only: [:show, :create, :edit, :update] def index diff --git a/app/controllers/project_packages_controller.rb b/app/controllers/project_packages_controller.rb index 6721c1c4..7a0990f3 100644 --- a/app/controllers/project_packages_controller.rb +++ b/app/controllers/project_packages_controller.rb @@ -1,10 +1,11 @@ # encoding=utf-8 # For react class ProjectPackagesController < ApplicationController - before_filter :require_login, :except => [:index, :show] - include ApplicationHelper + before_filter :require_login, except: [:index] + before_filter :check_authentication, except: [:index] + def show render_react end diff --git a/app/views/competitions/_qg_second_opensource.html.erb b/app/views/competitions/_qg_second_opensource.html.erb index 8aef0390..47fc814b 100644 --- a/app/views/competitions/_qg_second_opensource.html.erb +++ b/app/views/competitions/_qg_second_opensource.html.erb @@ -57,6 +57,14 @@ %> var userEnrolled = <%= user_enrolled %>; + var userProfileModal = function(url, str) { + var htmlvalue = '
        提示
        '+ + '

        ' + str + '

        ' + + '
        '; + pop_box_new(htmlvalue, 480, 205); + } + $(".enroll-btn.active").on("click", function(){ var url = $(this).data("url"); @@ -65,6 +73,11 @@ return; } + if (<%= !@user.profile_completed? %>) { + userProfileModal('/my/account', '您需要去完善您的个人资料,才能使用此功能'); + return + } + if (!userEnrolled) { $.ajax({ url: "/api/courses/apply_to_join_course.json", diff --git a/app/views/competitions/enroll.html.erb b/app/views/competitions/enroll.html.erb index ee439267..c2a3d029 100644 --- a/app/views/competitions/enroll.html.erb +++ b/app/views/competitions/enroll.html.erb @@ -5,8 +5,10 @@ <% if @maximum_staff > 1 %>

        <%= @competition.sub_title %>

        - <% unless User.current.logged? %> + <% if !User.current.logged? %> <%= link_to "创建战队", signin_path, :remote => true, :class => "enroll-in-b enroll-in-b-green fr" %> + <% elsif !User.current.try(:profile_completed?) %> + <%= link_to "创建战队", 'javascript:void(0)', :class => "enroll-in-b enroll-in-b-green fr", onclick: "userProfileModal()" %> <% else %> <% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %> <% if !@can_enroll %> @@ -19,8 +21,10 @@ <% end %> <% end %> - <% unless User.current.logged? %> + <% if !User.current.logged? %> <%= link_to "加入战队", signin_path, :remote => true, :class => "enroll-in-b fr" %> + <% elsif !User.current.try(:profile_completed?) %> + <%= link_to "加入战队", 'javascript:void(0)', :class => "enroll-in-b fr", onclick: "userProfileModal()" %> <% else %> <% unless @competition.enroll_end_time.present? && @competition.enroll_end_time < Time.now %> <% if !@can_enroll %> @@ -153,6 +157,14 @@ pop_box_new(htmlvalue, 500, 205); } + function userProfileModal() { + var htmlvalue = '

        提示
        '+ + '

        您需要去完善您的个人资料,才能使用此功能

        ' + + '
        '; + pop_box_new(htmlvalue, 480, 205); + } + function joinSure() { if ($("#codeinput").val().trim() == "") { $("#codeInput-notice").html("请输入邀请码"); From a7606d41dd63bdab08ed1f5f27a50250fcae2ba9 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 26 Jul 2019 10:55:57 +0800 Subject: [PATCH 28/30] add flag to redirect user profile --- app/helpers/application_helper.rb | 2 +- app/views/competitions/_qg_second_opensource.html.erb | 2 +- app/views/competitions/enroll.html.erb | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5737f99b..10e64bcf 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -629,7 +629,7 @@ module ApplicationHelper end =end if !User.current.profile_completed? - redirect_to my_account_path + redirect_to my_account_path(need_profile_completed: true) Rails.logger.info("check_authentication end") elsif User.current.certification != 1 # 系统没有授权 day_cer = UserDayCertification.where(:user_id => User.current.id).last diff --git a/app/views/competitions/_qg_second_opensource.html.erb b/app/views/competitions/_qg_second_opensource.html.erb index 47fc814b..87847a46 100644 --- a/app/views/competitions/_qg_second_opensource.html.erb +++ b/app/views/competitions/_qg_second_opensource.html.erb @@ -74,7 +74,7 @@ } if (<%= !@user.profile_completed? %>) { - userProfileModal('/my/account', '您需要去完善您的个人资料,才能使用此功能'); + userProfileModal('/my/account?need_profile_completed=true', '您需要去完善您的个人资料,才能使用此功能'); return } diff --git a/app/views/competitions/enroll.html.erb b/app/views/competitions/enroll.html.erb index c2a3d029..d5dde153 100644 --- a/app/views/competitions/enroll.html.erb +++ b/app/views/competitions/enroll.html.erb @@ -161,7 +161,7 @@ var htmlvalue = '
        提示
        '+ '

        您需要去完善您的个人资料,才能使用此功能

        ' + '
        '; + '立即完善
'; pop_box_new(htmlvalue, 480, 205); } From 3275a3fff05d6aaeb337171ff6b4d332945c658a Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 26 Jul 2019 11:04:08 +0800 Subject: [PATCH 29/30] add user profile check to join course btn --- app/views/competitions/enroll.html.erb | 2 +- app/views/layouts/_logined_header.html.erb | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/app/views/competitions/enroll.html.erb b/app/views/competitions/enroll.html.erb index d5dde153..4afb4ceb 100644 --- a/app/views/competitions/enroll.html.erb +++ b/app/views/competitions/enroll.html.erb @@ -161,7 +161,7 @@ var htmlvalue = '
提示
'+ '

您需要去完善您的个人资料,才能使用此功能

' + '
'; + '立即完善
'; pop_box_new(htmlvalue, 480, 205); } diff --git a/app/views/layouts/_logined_header.html.erb b/app/views/layouts/_logined_header.html.erb index 6b9cde10..e0bb5701 100644 --- a/app/views/layouts/_logined_header.html.erb +++ b/app/views/layouts/_logined_header.html.erb @@ -85,7 +85,13 @@
  • <%= link_to '新建项目', new_project_path() %>
  • @@ -154,4 +160,12 @@ <% end %> }); + + function showUserProfileModal() { + var htmlvalue = '
    提示
    '+ + '

    您需要去完善您的个人资料,才能使用此功能

    ' + + '
    取消'+ + '立即完善
    '; + pop_box_new(htmlvalue, 480, 205); + } \ No newline at end of file From 8c79d2f33c835dc93e45b49f33bb21e0a6f4fd9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 26 Jul 2019 15:33:36 +0800 Subject: [PATCH 30/30] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E8=AE=AD=E7=BB=83=E6=96=87=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../_gq_second_code_competition.html.erb | 340 +++++++++--------- 1 file changed, 170 insertions(+), 170 deletions(-) diff --git a/app/views/competitions/_gq_second_code_competition.html.erb b/app/views/competitions/_gq_second_code_competition.html.erb index 0baf1fe4..7e681b2e 100644 --- a/app/views/competitions/_gq_second_code_competition.html.erb +++ b/app/views/competitions/_gq_second_code_competition.html.erb @@ -1,171 +1,171 @@ -<% index = 0 %> -

    -<% index += 1%> -

    -<% index += 1 %> - -<% - challenge_description_extra = [ - "模拟赛选择了第一届标注大赛正式赛第一阶段的三个项目供大家体验熟悉平台、学习其他人的标注,模拟赛标注不计分。", - "第一阶段比赛得分占正赛总比分的30%。", - "第二阶段比赛得分占正赛总比分的70%。" - ] - data = [ - [ - { - name: 'Java项目', - description: "Weka是基于Java的机器学习与数据挖掘平台,汇集了最前沿的机器学习算法,包括处理标准数据挖掘问题的几乎所有方法:回归、分类、聚类、关联规则以及属性选择等,是Java机器学习入门的首选平台。

    本项目的Clusters目录中包含了K-Means、层次聚类等多种聚类算法以及相应的聚类效果评估方法的java实现", - task: '标注../weka/clusterers/目录下的所有代码文件。', - link_name: 'CSDN,经典聚类算法', - link_url: 'https://blog.csdn.net/qq_30262201/article/details/78799926' - }, - { - name: 'C++项目', - description: "该项目是GitHub上最受欢迎的C++语言实现经典算法与数据结构的项目之一,内容涵盖排序、链表、树结构、图搜索、贪心算法等。学习这些算法的代码实现,可以深刻理解和掌握算法的核心思想,感受算法之美,代码之美,是人工智能时代的基础入门一课。

    本项目的sort_search_problems目录涵盖了冒泡排序、快速排序等各类经典排序算法的C++实现。", - task: '标注../sort_search_problems目录下的所有代码文件及对应引用的../include目录中自定义的头文件。', - link_name: 'CSDN,十大经典排序算法', - link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476' - }, - { - name: 'Python项目', - description: "该项目是GitHub上最受欢迎的Python语言实现经典算法的项目之一,包含了前沿的神经网络和经典数据结构及算法的Python实现。项目具有兼顾经典和前沿的特点。学习经典算法的源码实现,感受经典算法的思想之美、代码之美。

    本项目的Sorts目录中包含了冒泡排序、快速排序等各类经典排序算法的Python实现。", - task: '标注../sorts/目录下的所有代码文件。', - link_name: 'CSDN,十大经典排序算法', - link_url: 'https://blog.csdn.net/wfq784967698/article/details/79551476' - }, - ], - [{ - name: 'Java项目', - description: "CoreNLP是一个Java自然语言分析库,是斯坦福大学自然语言处理小组的研究成果,它集成了所有的自然语言处理工具:分词、词性标注、依存句法分析、命名实体识别等。

    本项目的stanford/nlp/parser/目录中包含了Lexparser、nndep以及Shiftreduce等句法分析算法的Java实现。", - task: '标注../stanford/nlp/parser/目录下的所有代码文件(包括子目录)。', - link_name: 'CSDN, 使用Stanford Parser进行句法分析', - link_url: 'https://blog.csdn.net/u010239102/article/details/78111760' - },{ - name: 'C++项目', - description: "Sentencepiece是Google公司开发的一个C++自然语言处理工具包,它实现了数据驱动、跨语言、高性能、轻量级的面向神经网络文本生成系统的无监督文本词条化工具。

    本项目的src/目录中包含了BPE、Unigram以及Char等文本分词算法的C++实现。", - task: '标注../src/目录下的所有.cc和.h代码文件(不包括子目录)。(注:其中模型训练、测试相关代码可以去掉:*_test.cc, *_trainer.cc, *_trainer.h)', - link_name: 'CSDN, sentencePiece入门小结', - link_url: 'https://blog.csdn.net/sinat_33455447/article/details/90265938' - },{ - name: 'Python项目', - description: "NLTK是宾西法尼亚大学计算机和信息科学系开发的一个Python自然语言处理工具包,它提供了易于使用的接口,通过这些接口可以访问超过50个语料库和词汇资源(如WordNet),还有一套用于分类、标记化、词干标记、解析和语义推理的文本处理库。

    本项目的nltk/stem/目录中包含了Lancaster、Porter以及Snowball等文本分词算法的Python实现。", - task: '标注../nltk/stem/目录下的所有代码文件。', - link_name: 'CSDN, 英文分词的算法和原理', - link_url: 'https://blog.csdn.net/wisdom77/article/details/79446674' - }], - [{ - name: 'Java项目', - description: "Deeplearning4j是Eclipse公司开发的支持各种深度学习算法的运算框架,它可以实施的技术包括受限玻尔兹曼机、深度置信网络、深度自动编码器、堆叠式降噪自动编码器、循环神经张量网络,以及word2vec、doc2vec和GloVe等。

    本项目的nn/layers/recurrent/目录中包含了循环神经网络RNN中LSTM、Bidirectional LSTM等算法的Java实现。", - task: '标注../nn/layers/recurrent/目录下的所有代码文件。', - link_name: '官方,DL4J快速入门指南', - link_url: 'https://deeplearning4j.org/cn/quickstart' - },{ - name: 'C++项目', - description: "TensorFlow是谷歌人工智能团队开发的用于机器学习和深度神经网络研究的开源框架,它在图形分类、音频处理、推荐系统和自然语言处理等场景下都有丰富的应用,提供了丰富的API,包括基本的向量矩阵计算、各种优化算法、各种卷积神经网络和循环神经网络基本单元的实现、以及可视化的辅助工具等。

    本项目的core/kernels/rnn/目录中包含了循环神经网络RNN中卷积GEMM、LSTM以及GRU算法的C++实现。", - task: '标注../core/kernels/rnn/目录下的所有代码文件。', - link_name: 'CSDN, 深度学习之RNN(循环神经网络)', - link_url: 'https://blog.csdn.net/qq_32241189/article/details/80461635' - },{ - name: 'Python项目', - description: "Keras是Google公司开发的高度模块化的神经网络学习框架,它是一个高层神经网络API,能够支持简易和快速的原型设计,支持CNN和RNN或二者的结合,且能够支持无缝CPU和GPU切换。

    本项目的keras/layers/目录中包含了神经网络运算层中Embedding、CNN以及RNN等算法的Python实现。", - task: '标注../keras/layers/目录下的所有代码文件。', - link_name: '官方, Keras说明文档', - link_url: 'https://keras.io/layers/about-keras-layers/' - }] - ] -%> - -<% @competition.competition_stages.includes(:competition_stage_sections).each_with_index do |stage, i| %> -
    - <% - first_section = stage.competition_stage_sections[0] - second_section = stage.competition_stage_sections[1] - %> -
    "> -

    <%= stage.name %>

    - -

    - 标注说明:每个小组选择一种编程语言的题目,针对标注任务中指定的标注模块,要求对代码模块、模块中的代码文件, 以及文件中的函数必须进行标注,关键代码块、代码行及关键变量等由参赛者自由选择进行标注。 正式赛第一阶段的比赛在标注阶段就开放查看所有人的标注,请大家根据个人理解,写出自己的风格。我们将综合考虑标注的原创性、准确性、 完整性和多样性等不同的维度对标注质量进行评分。<%= challenge_description_extra[i] %> -

    - - -
    -
    - <% index += 1 %> -<% end %> - -

    -<% index += 1 %> -

    -<% index += 1 %> -

    - - \ No newline at end of file