Commit 1dde90ecdc1edae96669362c340d616c3166ba96
1 parent
407f3753
Exists in
master
and in
48 other branches
Fix statistic block crash on profile template
Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
Showing
1 changed file
with
7 additions
and
2 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/statistic_block.rb
... | ... | @@ -55,8 +55,13 @@ class StatisticBlock < Block |
55 | 55 | def get_software_statistics |
56 | 56 | statistics = {} |
57 | 57 | software = SoftwareInfo.find_by_community_id(self.owner.id) |
58 | - statistics[:saved_resources] = software.saved_resources | |
59 | - statistics[:benefited_people] = software.benefited_people | |
58 | + if software.present? | |
59 | + statistics[:saved_resources] = software.saved_resources | |
60 | + statistics[:benefited_people] = software.benefited_people | |
61 | + else | |
62 | + statistics[:saved_resources] = 0 | |
63 | + statistics[:benefited_people] = 0 | |
64 | + end | |
60 | 65 | statistics |
61 | 66 | end |
62 | 67 | end | ... | ... |