json.hack do
  json.(@hack, :id, :name, :difficult, :time_limit, :description, :score, :identifier, :status, :praises_count)
  json.language @hack.language
  json.username @hack.user&.real_name
  json.user_path "/users/#{@hack.user&.login}"
  json.code @my_hack.code
  json.pass_count @hack.pass_num
  json.submit_count @hack.submit_num
  json.notes @my_hack.notes
  json.modify_code @modify
  json.passed @my_hack.passed
  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
  json.hack_manager @hack.manager?(current_user)
  json.admin current_user.admin_or_business?
end