Merge branch 'develop' into dev_partners

dev_local
cxt 6 years ago
commit bec7b0eb36

@ -1677,7 +1677,8 @@ class StudentWorkController < ApplicationController
def student_work_project def student_work_project
project = Project.where(:id => params[:projectName].to_i).first project = Project.where(:id => params[:projectName].to_i).first
if project.present? if project.present?
@work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first @work = @homework.student_works.where("user_id = #{User.current.id} and work_status = 0").first ||
StudentWork.create(homework_common_id: @homework.id, user_id: User.current.id)
if @work if @work
@work.update_column('project_id', params[:projectName].to_i) @work.update_column('project_id', params[:projectName].to_i)
end end

@ -6922,148 +6922,154 @@ def quote_resource_bank resource, course
end end
def quote_homework_bank homework, course def quote_homework_bank homework, course
new_homework = HomeworkCommon.new(:name => homework.name, :user_id => User.current.id, :description => homework.description, :homework_type => homework.homework_type, :late_penalty => 5, ActiveRecord::Base.transaction do
:course_id => course.id, :teacher_priority => 1, :anonymous_comment => 1, :quotes => 0, :is_open => 0, :homework_bank_id => homework.id, :score_open => 1, new_homework = HomeworkCommon.new(:name => homework.name, :user_id => User.current.id, :description => homework.description, :homework_type => homework.homework_type, :late_penalty => 5,
:anonymous_appeal => 0, :is_public => 0, :reference_answer => homework.reference_answer, :answer_public => 1, :allow_late => 1) :course_id => course.id, :teacher_priority => 1, :anonymous_comment => 1, :quotes => 0, :is_open => 0, :homework_bank_id => homework.id, :score_open => 1,
:anonymous_appeal => 0, :is_public => 0, :reference_answer => homework.reference_answer, :answer_public => 1, :allow_late => 1)
new_homework.homework_detail_manual = HomeworkDetailManual.new
new_homework_detail_manual = new_homework.homework_detail_manual new_homework.homework_detail_manual = HomeworkDetailManual.new
new_homework_detail_manual.te_proportion = 1.0 new_homework_detail_manual = new_homework.homework_detail_manual
new_homework_detail_manual.ta_proportion = 0 new_homework_detail_manual.te_proportion = 1.0
new_homework_detail_manual.comment_status = 0 new_homework_detail_manual.ta_proportion = 0
new_homework_detail_manual.comment_status = 0
new_homework_detail_manual.evaluation_num = 0
new_homework_detail_manual.absence_penalty = 0 new_homework_detail_manual.evaluation_num = 0
new_homework_detail_manual.absence_penalty = 0
if new_homework.homework_type == 2
new_homework.homework_detail_programing = HomeworkDetailPrograming.new if new_homework.homework_type == 2
new_homework.homework_detail_programing.ta_proportion = 0 new_homework.homework_detail_programing = HomeworkDetailPrograming.new
new_homework.homework_detail_programing.language = homework.language new_homework.homework_detail_programing.ta_proportion = 0
homework.homework_bank_tests.each_with_index do |homework_test| new_homework.homework_detail_programing.language = homework.language
new_homework.homework_tests << HomeworkTest.new( homework.homework_bank_tests.each_with_index do |homework_test|
input: homework_test.input, new_homework.homework_tests << HomeworkTest.new(
output: homework_test.output input: homework_test.input,
) output: homework_test.output
)
end
homework.homework_bank_samples.each_with_index do |homework_test|
new_homework.homework_samples << HomeworkSample.new(
input: homework_test.input,
output: homework_test.output
)
end
end end
homework.homework_bank_samples.each_with_index do |homework_test|
new_homework.homework_samples << HomeworkSample.new( if new_homework.homework_type == 3
input: homework_test.input, new_homework.homework_detail_group = HomeworkDetailGroup.new
output: homework_test.output new_homework.homework_detail_group.min_num = homework.min_num
) new_homework.homework_detail_group.max_num = homework.max_num
new_homework.homework_detail_group.base_on_project = homework.base_on_project
end end
end
if new_homework.homework_type == 3 homework.attachments.each do |attachment|
new_homework.homework_detail_group = HomeworkDetailGroup.new att = attachment.copy
new_homework.homework_detail_group.min_num = homework.min_num att.container_id = nil
new_homework.homework_detail_group.max_num = homework.max_num att.container_type = nil
new_homework.homework_detail_group.base_on_project = homework.base_on_project att.author_id = homework.user_id
end att.copy_from = attachment.id
att.save
new_homework.attachments << att
end
homework.attachments.each do |attachment| if new_homework.save
att = attachment.copy if new_homework.homework_type == 4
att.container_id = nil HomeworkCommonsShixuns.create(:homework_common_id => new_homework.id, :shixun_id => homework.homework_bank_shixun.shixun_id)
att.container_type = nil end
att.author_id = homework.user_id new_homework_detail_manual.save if new_homework_detail_manual
att.copy_from = attachment.id new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
att.save new_homework.homework_detail_group.save if new_homework.homework_detail_group
new_homework.attachments << att create_works_list new_homework
end
if new_homework.save homework.update_column(:quotes, homework.quotes+1)
if new_homework.homework_type == 4 QuestionBank.where(:container_id => homework.id, :container_type => ["Common", "Shixun", "Group"]).update_all(:quotes => homework.quotes)
HomeworkCommonsShixuns.create(:homework_common_id => new_homework.id, :shixun_id => homework.homework_bank_shixun.shixun_id)
end end
new_homework_detail_manual.save if new_homework_detail_manual return new_homework
new_homework.homework_detail_programing.save if new_homework.homework_detail_programing
new_homework.homework_detail_group.save if new_homework.homework_detail_group
create_works_list new_homework
homework.update_column(:quotes, homework.quotes+1)
QuestionBank.where(:container_id => homework.id, :container_type => ["Common", "Shixun", "Group"]).update_all(:quotes => homework.quotes)
end end
return new_homework
end end
def quote_exercise_bank exercise, course def quote_exercise_bank exercise, course
new_exercise = Exercise.new(:exercise_name => exercise.name, :exercise_description => exercise.description, :user_id => User.current.id, :is_public => 0, ActiveRecord::Base.transaction do
:exercise_status => 1, :show_result => 1, :course_id => course.id, :time => -1, :exercise_bank_id => exercise.id) new_exercise = Exercise.new(:exercise_name => exercise.name, :exercise_description => exercise.description, :user_id => User.current.id, :is_public => 0,
:exercise_status => 1, :show_result => 1, :course_id => course.id, :time => -1, :exercise_bank_id => exercise.id)
exercise.exercise_bank_questions.each do |q|
option = { exercise.exercise_bank_questions.each do |q|
:question_title => q[:question_title], option = {
:question_type => q[:question_type] || 1, :question_title => q[:question_title],
:question_number => q[:question_number], :question_type => q[:question_type] || 1,
:question_score => q[:question_score], :question_number => q[:question_number],
:shixun_id => q[:shixun_id] :question_score => q[:question_score],
} :shixun_id => q[:shixun_id]
exercise_question = new_exercise.exercise_questions.new option }
exercise_question = new_exercise.exercise_questions.new option
if q.question_type != 5
for i in 1..q.exercise_bank_choices.count if q.question_type != 5
choice_option = { for i in 1..q.exercise_bank_choices.count
:choice_position => i, choice_option = {
:choice_text => q.exercise_bank_choices[i-1][:choice_text] :choice_position => i,
} :choice_text => q.exercise_bank_choices[i-1][:choice_text]
exercise_question.exercise_choices.new choice_option }
end exercise_question.exercise_choices.new choice_option
end
for i in 1..q.exercise_bank_standard_answers.count for i in 1..q.exercise_bank_standard_answers.count
standard_answer_option = { standard_answer_option = {
:exercise_choice_id => q.exercise_bank_standard_answers[i-1][:exercise_bank_choice_id], :exercise_choice_id => q.exercise_bank_standard_answers[i-1][:exercise_bank_choice_id],
:answer_text => q.exercise_bank_standard_answers[i-1][:answer_text] :answer_text => q.exercise_bank_standard_answers[i-1][:answer_text]
} }
exercise_question.exercise_standard_answers.new standard_answer_option exercise_question.exercise_standard_answers.new standard_answer_option
end end
else else
for i in 1..q.exercise_bank_shixun_challenges.count for i in 1..q.exercise_bank_shixun_challenges.count
challenge_option = { challenge_option = {
:position => i, :position => i,
:challenge_id => q.exercise_bank_shixun_challenges[i-1][:challenge_id], :challenge_id => q.exercise_bank_shixun_challenges[i-1][:challenge_id],
:shixun_id => q.exercise_bank_shixun_challenges[i-1][:shixun_id], :shixun_id => q.exercise_bank_shixun_challenges[i-1][:shixun_id],
:question_score => q.exercise_bank_shixun_challenges[i-1][:question_score] :question_score => q.exercise_bank_shixun_challenges[i-1][:question_score]
} }
exercise_question.exercise_shixun_challenges.new challenge_option exercise_question.exercise_shixun_challenges.new challenge_option
end
end end
end end
if new_exercise.save
create_exercises_list new_exercise
exercise.update_column(:quotes, exercise.quotes+1)
QuestionBank.where(:container_id => exercise.id, :container_type => "Exercise").update_all(:quotes => exercise.quotes)
end
return new_exercise
end end
if new_exercise.save
create_exercises_list new_exercise
exercise.update_column(:quotes, exercise.quotes+1)
QuestionBank.where(:container_id => exercise.id, :container_type => "Exercise").update_all(:quotes => exercise.quotes)
end
return new_exercise
end end
def quote_poll_bank poll, course def quote_poll_bank poll, course
new_poll = Poll.new(:polls_name => poll.name, :polls_description => poll.description, :user_id => User.current.id, :is_public => 0, ActiveRecord::Base.transaction do
:polls_status => 1, :show_result => 1, :polls_type => 'Course', :course_id => course.id, :exercise_bank_id => poll.id) new_poll = Poll.new(:polls_name => poll.name, :polls_description => poll.description, :user_id => User.current.id, :is_public => 0,
:polls_status => 1, :show_result => 1, :polls_type => 'Course', :course_id => course.id, :exercise_bank_id => poll.id)
poll.exercise_bank_questions.each do |q|
option = { poll.exercise_bank_questions.each do |q|
:question_title => q[:question_title], option = {
:question_type => q[:question_type] || 1, :question_title => q[:question_title],
:is_necessary => q[:is_necessary], :question_type => q[:question_type] || 1,
:question_number => q[:question_number], :is_necessary => q[:is_necessary],
:max_choices => q[:max_choices], :question_number => q[:question_number],
:min_choices => q[:min_choices] :max_choices => q[:max_choices],
} :min_choices => q[:min_choices]
poll_question = new_poll.poll_questions.new option
for i in 1..q.exercise_bank_choices.count
choice_option = {
:answer_position => i,
:answer_text => q.exercise_bank_choices[i-1][:choice_text]
} }
poll_question.poll_answers.new choice_option poll_question = new_poll.poll_questions.new option
for i in 1..q.exercise_bank_choices.count
choice_option = {
:answer_position => i,
:answer_text => q.exercise_bank_choices[i-1][:choice_text]
}
poll_question.poll_answers.new choice_option
end
end end
if new_poll.save
create_polls_list new_poll
poll.update_column(:quotes, poll.quotes+1)
QuestionBank.where(:container_id => poll.id, :container_type => "Poll").update_all(:quotes => poll.quotes)
end
return new_poll
end end
if new_poll.save
create_polls_list new_poll
poll.update_column(:quotes, poll.quotes+1)
QuestionBank.where(:container_id => poll.id, :container_type => "Poll").update_all(:quotes => poll.quotes)
end
return new_poll
end end
def major_level_option def major_level_option

@ -15,7 +15,7 @@ class HomeworkCommon < ActiveRecord::Base
belongs_to :homework_bank belongs_to :homework_bank
has_many :homework_group_settings, :dependent => :destroy has_many :homework_group_settings, :dependent => :destroy
has_one :homework_detail_manual, :dependent => :destroy has_one :homework_detail_manual, :dependent => :destroy
# has_one :homework_detail_programing, :dependent => :destroy has_one :homework_detail_programing, :dependent => :destroy
has_one :homework_detail_group, :dependent => :destroy has_one :homework_detail_group, :dependent => :destroy
has_one :homework_commons_shixuns, :dependent => :destroy has_one :homework_commons_shixuns, :dependent => :destroy
has_many :homework_challenge_settings, :dependent => :destroy has_many :homework_challenge_settings, :dependent => :destroy

@ -113,7 +113,7 @@
<% elsif work.present? && work.try(:work_status) != 0 %> <% elsif work.present? && work.try(:work_status) != 0 %>
<%= link_to "查看作品", student_work_path(work), :class => 'white-btn orange-btn fr mr20 mt8', :target => "_blank" %> <%= link_to "查看作品", student_work_path(work), :class => 'white-btn orange-btn fr mr20 mt8', :target => "_blank" %>
<% elsif ((work.present? && work.try(:work_status) == 0) || work.nil?) && setting_time.end_time > Time.now %> <% elsif ((work.present? && work.try(:work_status) == 0) || work.nil?) && setting_time.end_time > Time.now %>
<% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 && (work.project_id.nil? || work.project_id == 0 || work.project_id = -1) %> <% if homework_common.homework_type == 3 && homework_common.homework_detail_group.base_on_project == 1 && (work.try(:project_id).nil? || work.try(:project_id) == 0 || work.try(:project_id) == -1) %>
<%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => homework_common.id, :user_activity_id=> homework_common.id, :hw_status => 1), :remote => true, :class=> 'white-btn orange-btn fr mr20 mt8', :title=> '请各组长关联作业项目' %> <%= link_to "关联项目", new_student_work_project_student_work_index_path(:homework => homework_common.id, :user_activity_id=> homework_common.id, :hw_status => 1), :remote => true, :class=> 'white-btn orange-btn fr mr20 mt8', :title=> '请各组长关联作业项目' %>
<% else %> <% else %>
<%= link_to "提交作品", new_student_work_path(:homework => homework_common.id), :class => 'white-btn orange-btn fr mr20 mt8', :target => "_blank" %> <%= link_to "提交作品", new_student_work_path(:homework => homework_common.id), :class => 'white-btn orange-btn fr mr20 mt8', :target => "_blank" %>

@ -53,6 +53,9 @@
<li><%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %></li> <li><%= link_to '我的实训', user_path(User.current, :type => 'a_shixun') %></li>
<li><%= link_to '我的实训课程', user_path(User.current, :type => 'a_path') %></li> <li><%= link_to '我的实训课程', user_path(User.current, :type => 'a_path') %></li>
<li><%= link_to '我的项目', user_path(User.current, :type => 'a_project') %></li> <li><%= link_to '我的项目', user_path(User.current, :type => 'a_project') %></li>
<li><a>客户管理</a></li>
<% if User.current.department_members.count > 0 %> <% if User.current.department_members.count > 0 %>
<li><%= link_to '学院统计', statistics_college_path(User.current.department_members.first.try(:department)) %></li> <li><%= link_to '学院统计', statistics_college_path(User.current.department_members.first.try(:department)) %></li>
<% end %> <% end %>

@ -0,0 +1,42 @@
<p class="clearfix edu-back-white">
<span class="column-No">序号</span>
<span class="column-2">单位名称</span>
<span class="column-2">教师</span>
<span class="column-2">学生</span>
<span class="column-2">课堂</span>
<span class="column-2">发布实训</span>
<span class="column-2">实训报告</span>
<span class="column-2 fr">使用详情</span>
</p>
<ul class="minH-560 edu-back-white pb20 courselist">
<li class="clearfix bor-bottom-greyE" id="major_list">
<span class="column-No major_index">1</span>
<span class="column-2">国防科技大学</span>
<span class="column-2">22</span>
<span class="column-2">
33
</span>
<span class="column-2">
44
</span>
<span class="column-2">
55
</span>
<span class="column-2">
66
</span>
<span class="column-2 fr">
<a href="" class="color-blue">查看</a>
</span>
</li>
</ul>
<div class="educontent edu-txt-center mb80 mt20">
<div class="inline pages_user_show">
<ul>
<%= pagination_links_full @obj_pages, @obj_count, :per_page_links => false, :remote => true, :flag => true, :is_new => true %>
</ul>
<div class="cl"></div>
</div>
</div>

@ -0,0 +1,86 @@
<div id="Auth_main">
<div class="educontent clearfix edu-back-white bor-bottom-greyE">
<div class="padding20-30">
<!-- <p class="mb20"><span class="font-18 mr20">管理员</span><span class="font-12 color-grey-9"></span></p>-->
<!-- <ul class="clearfix managerPanels">-->
<!-- <a class="fl relative">-->
<!-- <img alt="头像" class="radius" height="48" src="https://www.educoder.net/images/avatars/User/6?1543479003" width="48" />-->
<!-- <i class="iconfont icon-shanchudiao userimg color-grey-9" ></i>-->
<!-- <span class="color-black">达达老师</span>-->
<!-- </a>-->
<!-- <a class="fl relative">-->
<!-- <i class="iconfont icon-tianjiafangda useradd color-grey-9"></i>-->
<!-- </a>-->
<!-- </ul>-->
<!-- <ul class="clearfix managerPanels">-->
<!-- <a class="fl font-16 padding5-20 block mr30 navItem active color-blue"><span class="fl">实训回复</span></a>-->
<!-- </ul>-->
</div>
</div>
<div class="educontent mb30">
<div class="clearfix padding20-30 bor-bottom-greyE edu-back-white">
<span class="fl font-12 mt5">
<span class="color-orange-tip mr3" id="search_major_count"><%= @obj_count %></span>
<span class="color-grey-9">个检索结果(<span id="all_major_count"><%= @major_count %></span> 单位)</span>
</span>
<div class="fr" id="pollingPanel">
<input type="text" name="search" placeholder="请输入单位名称搜索" />
<a href="javascript:void(0)" onclick="submit_search_major()"><i class="iconfont icon-sousuo font-16 color-grey-9"></i></a>
</div>
</div>
<div class="ListTableLine ListTableLines" id="school_major_list">
<%= render :partial => "department_list" %>
</div>
</div>
</div>
<script>
$(function(){
$(".MajorName i").click(function(){
$(this).parents(".MajorName").remove();
});
$("#school_major_list").on("click", ".addMajorManager", function(){
if($("#major_managers_"+$(this).attr("data-major-id")).children("span").length < 5){
var html="<%= escape_javascript(render :partial => "ecs/authList_addUnit") %>";
pop_box_new(html,572,500);
$("#object_id").val($(this).attr("data-major-id"));
$("#object_type").val('major');
$("input[name='school']").val('<%= @school.name %>');
} else {
notice_box("只能配置5个专业管理员");
}
});
$("#pollingPanel").on("keydown", "input[name='search']", function(e){
// 兼容FF和IE和Opera
var theEvent = e || window.event;
var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
if (code == 13) {
//回车执行查询
submit_search_major()
}
});
});
function submit_search_major(){
$.get('/ecs/department?school_id=<%= @school.id %>',
{ search: $("input[name='search']").val().trim()});
}
</script>

@ -3110,3 +3110,40 @@ line-height: 20px;display: inline-block;color: rgba(65, 140, 205, 1) !important;
width: calc( 100% ) width: calc( 100% )
} }
#requireTable thead .td-head-child:last-child{border-right: none;} #requireTable thead .td-head-child:last-child{border-right: none;}
/*用户列表*/
.managerPanels a{margin-right:24px;}
.managerPanels a:nth-child(16n){margin-right: 0px;}
.managerPanels a span{display: block;text-align: center;max-width: 70px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis;color: #666;}
.managerPanels a:hover span{color: #4cacff!important;}
.userimg{position: absolute;top: -16px;right: -5px;}
.useradd{font-size: 42px !important; position: absolute; top: -16px;}
.ListTableLines .column-2{
width: 150px;
text-align: center;
padding-left: 5px;
box-sizing: border-box;
color:#999999;
}
.ListTableLines .column-No{
color:#999999;
}
.courselist .column-2{
width: 150px;
text-align: center;
padding-left: 5px;
box-sizing: border-box;
color:#656565;
}
.courselist .column-No{
color:#999999;
}
.poll_list a {
display: inline-block;
padding: 20px;
font-size: 18px;
text-align: center;
position: relative;
color: #05101a;
}
Loading…
Cancel
Save