commit
2db0dca638
@ -0,0 +1,2 @@
|
|||||||
|
// Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
// All this logic will automatically be available in application.js.
|
@ -0,0 +1,3 @@
|
|||||||
|
// Place all the styles related to the edu_datas controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,29 @@
|
|||||||
|
class EduDatasController < ApplicationController
|
||||||
|
before_action :find_game
|
||||||
|
skip_before_action :user_setup
|
||||||
|
skip_before_action :setup_laboratory
|
||||||
|
# layout :false
|
||||||
|
include GitHelper
|
||||||
|
|
||||||
|
# params[:game_id]
|
||||||
|
def game
|
||||||
|
@shixun = @challenge.shixun
|
||||||
|
@shixun_env = @shixun.mirror_name
|
||||||
|
@shixun_tags = @challenge.challenge_tags.map(&:name)
|
||||||
|
end
|
||||||
|
|
||||||
|
def code_lines
|
||||||
|
path = @challenge.path
|
||||||
|
myshixun = @game.myshixun
|
||||||
|
# content = git_fle_content(myshixun.repo_path, path) || ""
|
||||||
|
@content = {"content":"#coding=utf-8\n\n#请在此处添加代码完成输出“Hello Python”,注意要区分大小写!\n###### Begin ######\n\n\n\n###### End ######\n\n"}
|
||||||
|
@content[:content].include?("Begin")
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
def find_game
|
||||||
|
game_id = params[:game_id]
|
||||||
|
@game = Game.find(game_id)
|
||||||
|
@challenge = @game.challenge
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,2 @@
|
|||||||
|
module EduDatasHelper
|
||||||
|
end
|
@ -0,0 +1 @@
|
|||||||
|
json.content @content
|
@ -0,0 +1,6 @@
|
|||||||
|
json.challenge @challenge
|
||||||
|
json.game @game
|
||||||
|
|
||||||
|
json.shixun @shixun
|
||||||
|
json.shixun_env @env
|
||||||
|
json.shixun_tags @shixun_tags
|
@ -0,0 +1,5 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe EduDatasController, type: :controller do
|
||||||
|
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the EduDatasHelper. For example:
|
||||||
|
#
|
||||||
|
# describe EduDatasHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
RSpec.describe EduDatasHelper, type: :helper do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in new issue