diff --git a/app/views/hack_user_lastest_codes/show.json.jbuilder b/app/views/hack_user_lastest_codes/show.json.jbuilder index cfdc87d25..be700f112 100644 --- a/app/views/hack_user_lastest_codes/show.json.jbuilder +++ b/app/views/hack_user_lastest_codes/show.json.jbuilder @@ -1,11 +1,12 @@ json.hack do - json.(@hack, :name, :difficult, :time_limit, :description, :score, :identifier, :status) + json.(@hack, :name, :difficult, :time_limit, :description, :score, :identifier, :status, :praises_count) 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 json.modify_code @modify + json.comments_count @hack.discusses.count end json.test_case do diff --git a/db/migrate/20191223120424_add_praises_count_for_hacks.rb b/db/migrate/20191223120424_add_praises_count_for_hacks.rb index 467c6f602..4c4f3a9e2 100644 --- a/db/migrate/20191223120424_add_praises_count_for_hacks.rb +++ b/db/migrate/20191223120424_add_praises_count_for_hacks.rb @@ -1,5 +1,6 @@ class AddPraisesCountForHacks < ActiveRecord::Migration[5.2] def change add_column :hacks, :praises_count, :integer, :default => 0 + add_column :hacks, :comments_count, :integer, :default => 0 end end