首页问题

dev_daiao
daiao 5 years ago
parent 685e4b09f8
commit 2a38bed1ad

@ -2,7 +2,9 @@ class HackUserLastestCodesController < ApplicationController
before_action :require_login
before_action :find_user_hack, only: [:show]
def show ;end
def show
end
private
def find_user_hack

@ -1,10 +1,16 @@
json.hack do
json.(@hack, :difficult, :time_limit, :description, :score)
json.(@hack, :difficult, :time_limit, :description, :score, :identifier)
json.language @hack.language
json.username @hack.user.real_name
json.code @my_hack.code
json.pass_count @hack.pass_num
json.submit_count @hack.submit_num
end
json.test_case do
json.input @hack.input_test_case
end
json.user_code do
json.code @my_hack.code
end

@ -6,6 +6,7 @@ class AddStatusEndTimeForHackUserLastestCode < ActiveRecord::Migration[5.2]
add_column :hack_user_lastest_codes, :identifier, :string
add_column :hacks, :hack_user_lastest_codes_count, :integer, :default => 0
add_column :hacks, :pass_num, :integer, :default => 0
add_column :hacks, :submit_num, :integer, :default => 0
add_index :hack_user_lastest_codes, :user_id, name: "user_index"
add_index :hack_user_lastest_codes, :hack_id, name: "hack_index"
add_index :hack_user_lastest_codes, :identifier, unique: true
Loading…
Cancel
Save