diff --git a/app/controllers/exercise_controller.rb b/app/controllers/exercise_controller.rb
index b4f1c7eb1..36d745b80 100644
--- a/app/controllers/exercise_controller.rb
+++ b/app/controllers/exercise_controller.rb
@@ -91,7 +91,7 @@ class ExerciseController < ApplicationController
@exercise.time = params[:exercise][:time]
@exercise.end_time = params[:exercise][:end_time]
@exercise.publish_time = params[:exercise][:publish_time]
- @exercise.publish_time = params[:exercise][:show_result]
+ @exercise.show_result = params[:exercise][:show_result]
if @exercise.save
respond_to do |format|
format.js
diff --git a/app/helpers/exercise_helper.rb b/app/helpers/exercise_helper.rb
index b9cd9c175..1768b7f19 100644
--- a/app/helpers/exercise_helper.rb
+++ b/app/helpers/exercise_helper.rb
@@ -13,11 +13,19 @@ module ExerciseHelper
def convert_to_char(str)
result = ""
- if str.count >= 1
- for i in 0 .. str.count do i
- result += (str[i].to_i + 64).chr
+ length = str.length
+ unless str.nil?
+ if length === 1
+ result += (str.to_i + 64).chr
+ return result
+ elsif length > 1
+ for i in 0...length
+ result += (str[i].to_i + 64).chr
+ end
+ return result
end
end
+ return result
end
end
\ No newline at end of file
diff --git a/app/views/exercise/_exercise_form.html.erb b/app/views/exercise/_exercise_form.html.erb
index c4b7ee421..8567c6641 100644
--- a/app/views/exercise/_exercise_form.html.erb
+++ b/app/views/exercise/_exercise_form.html.erb
@@ -319,7 +319,7 @@
<%= render :partial => 'edit_head', :locals => {:exercise => @exercise}%>
-
+
<%= render :partial => 'exercise_content', :locals => {:exercise => @exercise}%>
@@ -340,7 +340,7 @@
diff --git a/app/views/exercise/_new_MC.html.erb b/app/views/exercise/_new_MC.html.erb
index 5748713de..09e9e27f1 100644
--- a/app/views/exercise/_new_MC.html.erb
+++ b/app/views/exercise/_new_MC.html.erb
@@ -1,4 +1,3 @@
-<%#= form_for ExerciseQuestion.new,:url =>create_exercise_question_exercise_path(@exercise.id),:remote => true do |f|%>
<%= form_for(ExerciseQuestion.new,
:html => { :multipart => true },
:url => {:controller => 'exercise',
diff --git a/app/views/exercise/_new_MCQ.html.erb b/app/views/exercise/_new_MCQ.html.erb
index 4163e9f13..9b5c4adef 100644
--- a/app/views/exercise/_new_MCQ.html.erb
+++ b/app/views/exercise/_new_MCQ.html.erb
@@ -1,8 +1,14 @@
+<%= form_for(ExerciseQuestion.new,
+ :html => { :multipart => true },
+ :url => {:controller => 'exercise',
+ :action => 'create_exercise_question',
+ :course_id => @course.id
+ },:remote=>true ) do |f| %>
\ No newline at end of file
+
+<% end %>
\ No newline at end of file
diff --git a/app/views/exercise/_show_MC.html.erb b/app/views/exercise/_show_MC.html.erb
index bfaea32aa..09575ab00 100644
--- a/app/views/exercise/_show_MC.html.erb
+++ b/app/views/exercise/_show_MC.html.erb
@@ -1,6 +1,8 @@
第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)
- <%= exercise_question.question_title %>(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)
+ <%= exercise_question.question_title %>
+
(<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)
+
<%#= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
diff --git a/app/views/exercise/_show_MCQ.html.erb b/app/views/exercise/_show_MCQ.html.erb
index e69de29bb..9a7f82f54 100644
--- a/app/views/exercise/_show_MCQ.html.erb
+++ b/app/views/exercise/_show_MCQ.html.erb
@@ -0,0 +1,41 @@
+
+
第<%= exercise_question.question_number%>题.(<%= exercise_question.question_score %>分)
+ <%= exercise_question.question_title %>
+ (<%= convert_to_char(exercise_question.exercise_standard_answers.first.exercise_choice_id.to_s) %>)
+
+ <%#= link_to("", delete_poll_question_poll_index_path(:poll_question => poll_question.id),
+ method: :delete, :confirm => l(:text_are_you_sure), :remote => true, :class => "ur_icon_de") %>
+
+
+
+
+
+
+" +
+ "
" +
+ "<% if @exercise_questions.question_type == 1%>" +
+ "<%= escape_javascript(render :partial => 'show_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
+ "<% elsif @exercise_questions.question_type == 2%>" +
+ "<%= escape_javascript(render :partial => 'show_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
+ "<% elsif @exercise_questions.question_type == 3%>" +
+ "<%= escape_javascript(render :partial => 'show_single', :locals => {:exercise_question => @exercise_questions}) %>" +
+ "<% end%>" +
+ "
" +
+ "
" +
+ "<% if @exercise_questions.question_type == 1%>" +
+ "<%= escape_javascript(render :partial => 'edit_MC', :locals => {:exercise_question => @exercise_questions}) %>" +
+ "<% elsif @exercise_questions.question_type == 2%>" +
+ "<%= escape_javascript(render :partial => 'edit_MCQ', :locals => {:exercise_question => @exercise_questions}) %>" +
+ "<% elsif @exercise_questions.question_type == 3%>" +
+ "<%= escape_javascript(render :partial => 'edit_single', :locals => {:exercise_question => @exercise_questions}) %>" +
+ "<% end%>" +
+ "
" +
+ "
");
+<% end %>
diff --git a/db/schema.rb b/db/schema.rb
index 8d506225f..07dac5706 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -241,6 +241,58 @@ ActiveRecord::Schema.define(:version => 20151118015638) do
add_index "changesets_issues", ["changeset_id", "issue_id"], :name => "changesets_issues_ids", :unique => true
+ create_table "code_review_assignments", :force => true do |t|
+ t.integer "issue_id"
+ t.integer "change_id"
+ t.integer "attachment_id"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.string "action_type"
+ t.integer "changeset_id"
+ end
+
+ create_table "code_review_project_settings", :force => true do |t|
+ t.integer "project_id"
+ t.integer "tracker_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "updated_by"
+ t.boolean "hide_code_review_tab", :default => false
+ t.integer "auto_relation", :default => 1
+ t.integer "assignment_tracker_id"
+ t.text "auto_assign"
+ t.integer "lock_version", :default => 0, :null => false
+ t.boolean "tracker_in_review_dialog", :default => false
+ end
+
+ create_table "code_review_user_settings", :force => true do |t|
+ t.integer "user_id", :default => 0, :null => false
+ t.integer "mail_notification", :default => 0, :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "code_reviews", :force => true do |t|
+ t.integer "project_id"
+ t.integer "change_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "line"
+ t.integer "updated_by_id"
+ t.integer "lock_version", :default => 0, :null => false
+ t.integer "status_changed_from"
+ t.integer "status_changed_to"
+ t.integer "issue_id"
+ t.string "action_type"
+ t.string "file_path"
+ t.string "rev"
+ t.string "rev_to"
+ t.integer "attachment_id"
+ t.integer "file_count", :default => 0, :null => false
+ t.boolean "diff_all"
+ end
+
create_table "comments", :force => true do |t|
t.string "commented_type", :limit => 30, :default => "", :null => false
t.integer "commented_id", :default => 0, :null => false