Merge branch 'szzh' into develop

This commit is contained in:
huang 2015-07-21 15:55:13 +08:00
commit c34e2e9978
9 changed files with 60 additions and 40 deletions

View File

@ -514,7 +514,7 @@ private
end end
def has_login def has_login
unless @attachment.container_type == "PhoneAppVersion" unless @attachment && @attachment.container_type == "PhoneAppVersion"
render_403 unless User.current.logged? render_403 unless User.current.logged?
end end
end end

View File

@ -18,28 +18,28 @@ class HomeworkCommonController < ApplicationController
end end
def new def new
@homework_type = "1" # @homework_type = "1"
#
@homework = HomeworkCommon.new # @homework = HomeworkCommon.new
@homework.safe_attributes = params[:homework_common] # @homework.safe_attributes = params[:homework_common]
@homework.late_penalty = 0 # @homework.late_penalty = 0
@homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d') # @homework.end_time = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.publish_time = Time.now.strftime('%Y-%m-%d') # @homework.publish_time = Time.now.strftime('%Y-%m-%d')
#
if @homework_type == "1" # if @homework_type == "1"
#匿评作业相关属性 # #匿评作业相关属性
@homework_detail_manual = HomeworkDetailManual.new # @homework_detail_manual = HomeworkDetailManual.new
@homework_detail_manual.ta_proportion = 0.6 # @homework_detail_manual.ta_proportion = 0.6
@homework_detail_manual.absence_penalty = 0 # @homework_detail_manual.absence_penalty = 0
@homework_detail_manual.evaluation_num = 3 # @homework_detail_manual.evaluation_num = 3
@homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d') # @homework_detail_manual.evaluation_start = Time.now.strftime('%Y-%m-%d')
@homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d') # @homework_detail_manual.evaluation_end = (Time.now + 3600 * 24).strftime('%Y-%m-%d')
@homework.homework_detail_manual = @homework_detail_manual # @homework.homework_detail_manual = @homework_detail_manual
elsif @homework_type == "2" # elsif @homework_type == "2"
#编程作业相关属性 # #编程作业相关属性
@homework_detail_programing = HomeworkDetailPrograming.new # @homework_detail_programing = HomeworkDetailPrograming.new
@homework.homework_detail_programing = @homework_detail_programing # @homework.homework_detail_programing = @homework_detail_programing
end # end
respond_to do |format| respond_to do |format|
format.html format.html
end end
@ -93,7 +93,7 @@ class HomeworkCommonController < ApplicationController
if homework.homework_type == 2 if homework.homework_type == 2
homework_detail_programing = HomeworkDetailPrograming.new homework_detail_programing = HomeworkDetailPrograming.new
homework_detail_programing.language = "C++" homework_detail_programing.language = params[:language]
homework_detail_programing.standard_code = params[:standard_code] homework_detail_programing.standard_code = params[:standard_code]
homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6 homework_detail_programing.ta_proportion = params[:ta_proportion] || 0.6
question = {title:homework.name,content:homework.description} question = {title:homework.name,content:homework.description}

View File

@ -128,7 +128,7 @@ class StudentWorkController < ApplicationController
solutions = { solutions = {
student_work_id:stundet_work.id, student_work_id:stundet_work.id,
src:Base64.encode64(stundet_work.description), src:Base64.encode64(stundet_work.description),
language:1 language:@homework.homework_detail_programing.language
} }
uri = URI(url) uri = URI(url)
body = solutions.to_json body = solutions.to_json

View File

@ -27,6 +27,19 @@ module HomeworkCommonHelper
type type
end end
def programing_languages_options
type = []
option = []
option << "C"
option << 1
type << option
option_1 = []
option_1 << "C++"
option_1 << 2
type << option_1
type
end
#缺评扣分 #缺评扣分
def absence_penalty_option def absence_penalty_option
type = [] type = []

View File

@ -7,7 +7,7 @@ class StudentWork < ActiveRecord::Base
has_many :student_works_evaluation_distributions, :dependent => :destroy has_many :student_works_evaluation_distributions, :dependent => :destroy
has_many :student_works_scores, :dependent => :destroy has_many :student_works_scores, :dependent => :destroy
belongs_to :project belongs_to :project
has_one :student_work_test has_many :student_work_test
before_destroy :delete_praise before_destroy :delete_praise

View File

@ -56,9 +56,7 @@
<ul> <ul>
<li > <li >
<label class="label02">&nbsp;开发语言:&nbsp;</label> <label class="label02">&nbsp;开发语言:&nbsp;</label>
<select class="fl mb10 h26 w150" > <%= select_tag :language,options_for_select(programing_languages_options,homework.homework_detail_programing.language), {:class => "fl mb10 h26 w70"} %>
<option>C</option>
</select>
<div class="cl"></div> <div class="cl"></div>
</li> </li>

View File

@ -1,17 +1,27 @@
<%= javascript_include_tag "/assets/kindeditor/kindeditor" %>
<%= error_messages_for 'homework_common' %>
<div class="project_r_h"> <div class="project_r_h">
<h2 class="project_h2"> <h2 class="project_h2">
<%= l(:label_course_homework_new)%> <%= l(:label_course_homework_new)%>
</h2> </h2>
</div> </div>
<div class="hwork_new"> <div class="hwork_new" id="hwork_new">
<%= labelled_form_for @homework,:url => {:controller => 'homework_common',:action => 'create'} do |f| %> <%= form_for("new_homework_common",:url => next_step_homework_common_index_path) do |f|%>
<%= hidden_field_tag "course",@course.id%> <input type="hidden" name="course" value="<%= @course.id%>">
<%= render :partial => 'homework_common/homework_detail_manual_form', :locals => { :homework => @homework,:f => f,:edit_mode => false } %> <h3 class="c_blue f16 mb10">
<a href="javascript:void(0)" class="blue_btn fl mr10" onClick="submit_homework('new_homework_common');" >提交</a> 请选择将要发布的作业类型
<%#= link_to "上一步", new_homework_common_path(:course => @course.id), :class => "orange_btn_homework fl"%> </h3>
<%= link_to '取消',homework_common_index_path(:course => @course.id),:class => 'grey_btn fl'%> <input type="radio" class="mb10 fl" name="homework_common_type" value="1" id="homework_detail_manual_radio" checked/>
<span class="ml5 fl">
人工评分的作业(支持匿名互评、灵活设置评分比例)
</span>
<div class="cl"></div>
<input type="radio" class="mb20 fl" name="homework_common_type" value="2" id="homework_detail_programing_radio"/>
<span class="ml5 fl">
自动评测的编程作业支持C/C++程序的自动评分)
</span>
<div class="cl"></div>
<a href="javascript:void(0);" class=" orange_btn" onclick="$(this).parent().submit();">
下一步
</a>
<% end%> <% end%>
</div><!--hwork_new end--> </div><!--hwork_new end-->
<div class="cl"></div> <div class="cl"></div>

View File

@ -43,5 +43,5 @@
<div id="show_content_div" style="display: none;padding-top: 0px; "> <div id="show_content_div" style="display: none;padding-top: 0px; ">
<p class="pl10 f14 "><span style="color: #7f7f7f;font-size: 14px; ">所部署服务的网址:</span> <p class="pl10 f14 "><span style="color: #7f7f7f;font-size: 14px; ">所部署服务的网址:</span>
<span><a href="http://publify.forge.trustie.net" target="_Blank" style="color: #15BCCF;font-size: 14px;">http://publify.forge.trustie.net</a></span></p> <span><a href="http://rubyblog.forge.trustie.net/accounts/login" target="_Blank" style="color: #15BCCF;font-size: 14px;">http://rubyblog.forge.trustie.net/accounts/login</a></span></p>
</div> </div>

View File

@ -48,7 +48,6 @@
<%= test.output%> <%= test.output%>
</td> </td>
<td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td> <td class="td_50 c_red"><%= test.student_work_test.nil? ? "正在编译" : test.student_work_test.status_to_s%></td>
<td class="td_50 "><%= test.student_work_test.nil? ? "0" : test.student_work_test.test_score%></td>
<input type="hidden" value="<%= test.student_work_test.result if test.student_work_test%>"> <input type="hidden" value="<%= test.student_work_test.result if test.student_work_test%>">
</tr> </tr>
<% end%> <% end%>