Commit eacb4d70c2b2c8f804b9ba9f36fe17e8a68cf517

Authored by Luciano Prestes
1 parent b3d0d4e3

Fix bug on change statistic_block namespace type

Signed-off-by: Luciano Prestes <lucianopcbr@gmail.com>
Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com>
src/noosfero-spb/software_communities/db/migrate/20151124192503_update_namespace_types.rb
@@ -3,7 +3,7 @@ class UpdateNamespaceTypes &lt; ActiveRecord::Migration @@ -3,7 +3,7 @@ class UpdateNamespaceTypes &lt; ActiveRecord::Migration
3 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock' WHERE type = 'SoftwareHighlightsBlock'") 3 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock' WHERE type = 'SoftwareHighlightsBlock'")
4 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock' WHERE type = 'SearchCatalogBlock'") 4 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock' WHERE type = 'SearchCatalogBlock'")
5 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::DownloadBlock' WHERE type = 'DownloadBlock'") 5 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::DownloadBlock' WHERE type = 'DownloadBlock'")
6 - execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::StatisticsBlock' WHERE type = 'StatisticsBlock'") 6 + execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::StatisticBlock' WHERE type = 'StatisticBlock'")
7 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::RepositoryBlock' WHERE type = 'RepositoryBlock'") 7 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::RepositoryBlock' WHERE type = 'RepositoryBlock'")
8 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock' WHERE type = 'SoftwareTabDataBlock'") 8 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock' WHERE type = 'SoftwareTabDataBlock'")
9 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwaresBlock' WHERE type = 'SoftwaresBlock'") 9 execute("UPDATE blocks SET type = 'SoftwareCommunitiesPlugin::SoftwaresBlock' WHERE type = 'SoftwaresBlock'")
@@ -18,7 +18,7 @@ class UpdateNamespaceTypes &lt; ActiveRecord::Migration @@ -18,7 +18,7 @@ class UpdateNamespaceTypes &lt; ActiveRecord::Migration
18 execute("UPDATE blocks SET type = 'SoftwareHighlightsBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock'") 18 execute("UPDATE blocks SET type = 'SoftwareHighlightsBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareHighlightsBlock'")
19 execute("UPDATE blocks SET type = 'SearchCatalogBlock' WHERE type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock'") 19 execute("UPDATE blocks SET type = 'SearchCatalogBlock' WHERE type = 'SoftwareCommunitiesPlugin::SearchCatalogBlock'")
20 execute("UPDATE blocks SET type = 'DownloadBlock' WHERE type = 'SoftwareCommunitiesPlugin::DownloadBlock'") 20 execute("UPDATE blocks SET type = 'DownloadBlock' WHERE type = 'SoftwareCommunitiesPlugin::DownloadBlock'")
21 - execute("UPDATE blocks SET type = 'StatisticsBlock' WHERE type = 'SoftwareCommunitiesPlugin::StatisticsBlock'") 21 + execute("UPDATE blocks SET type = 'StatisticBlock' WHERE type = 'SoftwareCommunitiesPlugin::StatisticBlock'")
22 execute("UPDATE blocks SET type = 'RepositoryBlock' WHERE type = 'SoftwareCommunitiesPlugin::RepositoryBlock'") 22 execute("UPDATE blocks SET type = 'RepositoryBlock' WHERE type = 'SoftwareCommunitiesPlugin::RepositoryBlock'")
23 execute("UPDATE blocks SET type = 'SoftwareTabDataBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock'") 23 execute("UPDATE blocks SET type = 'SoftwareTabDataBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwareTabDataBlock'")
24 execute("UPDATE blocks SET type = 'SoftwaresBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwaresBlock'") 24 execute("UPDATE blocks SET type = 'SoftwaresBlock' WHERE type = 'SoftwareCommunitiesPlugin::SoftwaresBlock'")
src/noosfero-spb/software_communities/lib/software_communities_plugin/statistic_block.rb
@@ -54,7 +54,7 @@ class SoftwareCommunitiesPlugin::StatisticBlock &lt; Block @@ -54,7 +54,7 @@ class SoftwareCommunitiesPlugin::StatisticBlock &lt; Block
54 54
55 def get_software_statistics 55 def get_software_statistics
56 statistics = {} 56 statistics = {}
57 - software = SoftwareInfo.find_by_community_id(self.owner.id) 57 + software = SoftwareCommunitiesPlugin::SoftwareInfo.find_by_community_id(self.owner.id)
58 if software.present? 58 if software.present?
59 statistics[:saved_resources] = software.saved_resources 59 statistics[:saved_resources] = software.saved_resources
60 statistics[:benefited_people] = software.benefited_people 60 statistics[:benefited_people] = software.benefited_people