You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
educoder/app/views/hack_user_lastest_codes/show.json.jbuilder

24 lines
781 B

json.hack do
5 years ago
json.(@hack, :id, :name, :difficult, :time_limit, :description, :score, :identifier, :status, :praises_count)
json.language @hack.language
5 years ago
json.username @hack.user&.real_name
json.user_path "/users/#{@hack.user&.login}"
json.code @my_hack.code
5 years ago
json.pass_count @hack.pass_num
json.submit_count @hack.submit_num
5 years ago
json.notes @my_hack.notes
json.modify_code @modify
5 years ago
json.passed @my_hack.passed
5 years ago
json.comments_count @hack.discusses.count
json.user_praise @hack.praise_treads.select{|pt| pt.user_id == current_user.id}.length > 0
end
json.test_case do
json.input @hack.input_test_case
end
json.user do
json.partial! 'users/user', user: current_user
5 years ago
json.hack_manager @hack.manager?(current_user)
json.admin current_user.admin_or_business?
end