diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index a7d4a7c08..b01ff6c14 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -33,6 +33,7 @@ class GamesController < ApplicationController # logger.info("#################%%%%%%#{@game.outputs.first.out_put}") # @games = @myshixun.games.includes(:challenge) @challenges = Challenge.where(:shixun_id => @myshixun.shixun_id) + @shixun = @myshixun.shixun # @games_count = @games.count @game_challenge = @game.challenge @had_done = @game.had_done diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index ac496314e..711ff46e2 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -300,7 +300,7 @@ class ShixunsController < ApplicationController CODES = %W(2 3 4 5 6 7 8 9 a b c f e f g h i j k l m n o p q r s t u v w x y z) def copy_myshixun shixun, gshixun myshixun = Myshixun.new - myshixun.attributes = shixun.attributes.dup.except("id","user_id","visits","gpid","status", "identifier") + myshixun.attributes = shixun.attributes.dup.except("id","user_id","visits","gpid","status", "identifier","propaedeutics") myshixun.shixun_id = shixun.id myshixun.user_id = User.current.id myshixun.gpid = gshixun.id diff --git a/app/views/games/_game_show.html.erb b/app/views/games/_game_show.html.erb index 7547a2226..73caee78e 100644 --- a/app/views/games/_game_show.html.erb +++ b/app/views/games/_game_show.html.erb @@ -38,7 +38,7 @@
- +
diff --git a/db/migrate/20170518064248_sync_propaedeutics_to_shixuns.rb b/db/migrate/20170518064248_sync_propaedeutics_to_shixuns.rb new file mode 100644 index 000000000..f34a762d0 --- /dev/null +++ b/db/migrate/20170518064248_sync_propaedeutics_to_shixuns.rb @@ -0,0 +1,12 @@ +class SyncPropaedeuticsToShixuns < ActiveRecord::Migration + def up + change_column :challenges, :ready_knowledge, :longtext + Shixun.all.each do |shixun| + ready_knowledge = shixun.challenges.first.try(:ready_knowledge) + shixun.update_attribute(:propaedeutics, ready_knowledge) + end + end + + def down + end +end