Skip to content

Commit

Permalink
[api] No more beauty
Browse files Browse the repository at this point in the history
Remove `update_counter` attribute from `Package` as it is not used, and before
62337a9 it was not even always update.
  • Loading branch information
Ana06 committed Mar 17, 2017
1 parent d561995 commit 6389055
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 48 deletions.
3 changes: 0 additions & 3 deletions src/api/app/models/package.rb
Expand Up @@ -1389,8 +1389,6 @@ def update_activity
new_activity > 100 ? 100 : new_activity

self.activity_index = new_activity
# just for beauty
self.update_counter += 1
end
end

Expand All @@ -1406,7 +1404,6 @@ def update_activity
# created_at :datetime
# updated_at :datetime indexed
# url :string(255)
# update_counter :integer default(0)
# activity_index :float(24) default(100.0)
# bcntsynctag :string(255)
# develpackage_id :integer indexed
Expand Down
Expand Up @@ -5,7 +5,6 @@ xml.most_active do
@packages.each do |package|
xml.package(
:activity => package.activity_value,
:update_count => package.update_counter,
:project => package.project.name,
:name => package.name
)
Expand Down
@@ -0,0 +1,5 @@
class RemoveUpdateCounterFromPackage < ActiveRecord::Migration[5.0]
def change
remove_column :packages, :update_counter, :integer
end
end
2 changes: 1 addition & 1 deletion src/api/db/structure.sql
Expand Up @@ -704,7 +704,6 @@ CREATE TABLE `packages` (
`created_at` datetime DEFAULT NULL,
`updated_at` datetime DEFAULT NULL,
`url` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`update_counter` int(11) DEFAULT '0',
`activity_index` float DEFAULT '100',
`bcntsynctag` varchar(255) CHARACTER SET utf8 DEFAULT NULL,
`develpackage_id` int(11) DEFAULT NULL,
Expand Down Expand Up @@ -1407,6 +1406,7 @@ INSERT INTO schema_migrations (version) VALUES
('20170315190919'),
('20170315200936'),
('20170317094221'),
('20170316090223'),
('21'),
('22'),
('23'),
Expand Down
37 changes: 0 additions & 37 deletions src/api/test/fixtures/packages.yml
Expand Up @@ -5,7 +5,6 @@ Apache_Taskjuggler:
created_at: 2005-01-01 01:00:01.000000000 Z
updated_at: 2005-01-01 01:00:01.000000000 Z
url: http://some.url
update_counter: 0
activity_index: 100.0
delta: 1
project: Apache
Expand All @@ -16,7 +15,6 @@ Apache_Tidy:
created_at: 2005-01-01 01:00:01.000000000 Z
updated_at: 2005-01-01 01:00:01.000000000 Z
url: http://some.url
update_counter: 0
activity_index: 100.0
delta: 1
project: Apache
Expand All @@ -27,7 +25,6 @@ Apache_apache2:
created_at: 2005-01-01 01:00:02.000000000 Z
updated_at: 2007-01-19 11:44:45.000000000 Z
url: http://httpd.apache.org
update_counter: 0
activity_index: 100.0
delta: 1
project: Apache
Expand All @@ -38,7 +35,6 @@ Apache_libapr-util1:
created_at: 2005-01-01 01:00:02.000000000 Z
updated_at: 2007-01-19 11:44:45.000000000 Z
url: http://some.url
update_counter: 0
activity_index: 100.0
delta: 1
project: Apache
Expand All @@ -48,7 +44,6 @@ BaseDistro2.0_pack2:
description: ''
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro2.0
Expand All @@ -59,7 +54,6 @@ BaseDistro2.0_pack2.linked:
bcntsynctag: pack2
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro2.0
Expand All @@ -69,7 +63,6 @@ LinkedUpdateProject_pack_local:
description: ''
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro2.0_LinkedUpdateProject
Expand All @@ -80,7 +73,6 @@ BaseDistro3_pack2:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro3
Expand All @@ -90,7 +82,6 @@ BaseDistro_Update_pack2:
description: ''
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro_Update
Expand All @@ -102,7 +93,6 @@ BaseDistro_pack1:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro
Expand All @@ -113,7 +103,6 @@ BaseDistro_pack2:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro
Expand All @@ -124,7 +113,6 @@ BaseDistro_pack3:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
bcntsynctag: pack1
delta: 1
Expand All @@ -136,7 +124,6 @@ BaseDistro_product:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro
Expand All @@ -147,7 +134,6 @@ BaseDistro_product_fixed_release:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro
Expand All @@ -158,7 +144,6 @@ BaseDistro_patchinfo:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: BaseDistro
Expand All @@ -169,7 +154,6 @@ BinaryprotectedProject_bdpack:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: BinaryprotectedProject
Expand All @@ -180,7 +164,6 @@ CopyTest_target:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: CopyTest
Expand All @@ -191,7 +174,6 @@ CopyTest_test:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: CopyTest
Expand All @@ -202,7 +184,6 @@ Devel_BaseDistro_Update_pack2:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: Devel_BaseDistro_Update
Expand All @@ -213,7 +194,6 @@ Devel_BaseDistro_Update_pack3:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: Devel_BaseDistro_Update
Expand All @@ -224,7 +204,6 @@ HiddenProject_pack:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: HiddenProject
Expand All @@ -235,7 +214,6 @@ HiddenProject_packCopy:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: HiddenProject
Expand All @@ -246,7 +224,6 @@ HiddenProject_target:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: HiddenProject
Expand All @@ -257,7 +234,6 @@ LocalProject_newpackage:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: LocalProject
Expand All @@ -268,7 +244,6 @@ LocalProject_remotepackage:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: LocalProject
Expand All @@ -279,7 +254,6 @@ SourceprotectedProject_pack:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: SourceprotectedProject
Expand All @@ -290,7 +264,6 @@ SourceprotectedProject_target:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: SourceprotectedProject
Expand All @@ -301,7 +274,6 @@ home_Iggy_TestPack:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: home_Iggy
Expand All @@ -312,7 +284,6 @@ home_Iggy_ToBeDeletedTestPack:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: home_Iggy
Expand All @@ -323,7 +294,6 @@ home_Iggy_branches_kde4_BranchPack:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: home_Iggy_branches_kde4
Expand All @@ -334,7 +304,6 @@ home_adrian_ProtectionTest_aggregate:
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
url: ''
update_counter: 1
activity_index: 10.0
delta: 1
project: home_adrian_ProtectionTest
Expand All @@ -344,7 +313,6 @@ home_coolo_test_kdelibs_DEVEL_package:
description: blub
created_at: 2001-01-01 02:01:01.000000000 Z
updated_at: 2002-02-02 03:02:02.000000000 Z
update_counter: 0
activity_index: 100.0
delta: 1
project: home_coolo_test
Expand All @@ -355,7 +323,6 @@ home_dmayr_x11vnc:
created_at: 2005-01-01 01:00:02.000000000 Z
updated_at: 2007-01-25 12:48:59.000000000 Z
url: http://geblubberblah/total/egal
update_counter: 0
activity_index: 100.0
delta: 1
project: home_dmayr
Expand All @@ -365,7 +332,6 @@ home_king_commentpack:
description: description
created_at: 2014-02-14 01:00:02.000000000 Z
updated_at: 2014-02-14 12:48:59.000000000 Z
update_counter: 0
activity_index: 100.0
delta: 1
project: home_king
Expand All @@ -375,7 +341,6 @@ kde4_kdebase:
description: blub
created_at: 2001-01-01 02:01:01.000000000 Z
updated_at: 2002-02-02 03:02:02.000000000 Z
update_counter: 0
activity_index: 100.0
delta: 1
project: kde4
Expand All @@ -385,7 +350,6 @@ kde4_kdelibs:
description: blub
created_at: 2001-01-01 02:01:01.000000000 Z
updated_at: 2002-02-02 03:02:02.000000000 Z
update_counter: 0
activity_index: 100.0
delta: 1
project: kde4
Expand All @@ -396,7 +360,6 @@ BrokenPublishing_pack_broken_publish:
description: ''
created_at: 2007-05-16 16:19:18.000000000 Z
updated_at: 2007-05-16 16:19:18.000000000 Z
update_counter: 1
activity_index: 10.0
delta: 1
project: BrokenPublishing
5 changes: 2 additions & 3 deletions src/api/test/functional/statistics_controller_test.rb
Expand Up @@ -176,9 +176,8 @@ def test_most_active

assert_xml_tag tag: 'most_active', child: { tag: 'package' }
assert_xml_tag tag: 'package', attributes: {
name: "kdelibs",
project: "kde4",
update_count: 1
name: "kdelibs",
project: "kde4"
}
assert_no_xml_tag tag: 'package', attributes: { project: "HiddenProject" }

Expand Down
3 changes: 0 additions & 3 deletions src/api/test/unit/package_test.rb
Expand Up @@ -252,7 +252,6 @@ def test_activity
# freshly created it should have 20
assert_equal 20, newyear.activity_index
assert_in_delta(20.0, newyear.activity, 0.2)
assert_equal 0, newyear.update_counter

# a month later now
Timecop.freeze(2010, 2, 1)
Expand All @@ -264,7 +263,6 @@ def test_activity

newyear.title = "Just a silly update"
newyear.save
assert_equal 1, newyear.update_counter
assert_in_delta(22.9, newyear.activity, 0.2)

Timecop.freeze(2010, 4, 1)
Expand All @@ -275,7 +273,6 @@ def test_activity

newyear.title = "Just a silly update 2"
newyear.save
assert_equal 2, newyear.update_counter
assert_in_delta(24.7, newyear.activity, 0.2)
newyear.title = "Just a silly update 3"
newyear.save
Expand Down

0 comments on commit 6389055

Please sign in to comment.