parent
3e68b5a652
commit
685e4b09f8
@ -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 HackUserLastestCodes controller here.
|
||||
// They will automatically be included in application.css.
|
||||
// You can use Sass (SCSS) here: http://sass-lang.com/
|
@ -0,0 +1,13 @@
|
||||
class HackUserLastestCodesController < ApplicationController
|
||||
before_action :require_login
|
||||
before_action :find_user_hack, only: [:show]
|
||||
|
||||
def show ;end
|
||||
|
||||
private
|
||||
def find_user_hack
|
||||
@my_hack = HackUserLastestCode.find_by(identifier: params[:identifier])
|
||||
@hack = @my_hack.hack
|
||||
end
|
||||
|
||||
end
|
@ -0,0 +1,2 @@
|
||||
module HackUserLastestCodesHelper
|
||||
end
|
@ -1,3 +1,4 @@
|
||||
class HackSet < ApplicationRecord
|
||||
# 编程题测试集
|
||||
belongs_to :hack
|
||||
end
|
||||
|
@ -0,0 +1,10 @@
|
||||
json.hack do
|
||||
json.(@hack, :difficult, :time_limit, :description, :score)
|
||||
json.language @hack.language
|
||||
json.username @hack.user.real_name
|
||||
json.code @my_hack.code
|
||||
end
|
||||
|
||||
json.test_case do
|
||||
json.input @hack.input_test_case
|
||||
end
|
@ -0,0 +1,5 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe HackUserLastestCodesController, type: :controller do
|
||||
|
||||
end
|
@ -0,0 +1,15 @@
|
||||
require 'rails_helper'
|
||||
|
||||
# Specs in this file have access to a helper object that includes
|
||||
# the HackUserLastestCodesHelper. For example:
|
||||
#
|
||||
# describe HackUserLastestCodesHelper 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 HackUserLastestCodesHelper, type: :helper do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in new issue