Commit 5fe95a754a7a0c7e87ae44574d5350ec8e0ce50d
1 parent
333720e2
Exists in
organization_rating_style_changes
Update methods called on view to display software statistics
Signed-off-by: Pedro de Lyra <pedrodelyra@gmail.com> Signed-off-by: Tallys Martins <tallysmartins@yahoo.com.br>
Showing
3 changed files
with
32 additions
and
23 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/ext/create_organization_rating_comment.rb
... | ... | @@ -5,7 +5,6 @@ CreateOrganizationRatingComment.class_eval do |
5 | 5 | |
6 | 6 | def clear_rejected_rating_values |
7 | 7 | if(self.status == Task::Status::CANCELLED) |
8 | - puts "-----------------"*50 | |
9 | 8 | rating = OrganizationRating.find(self.organization_rating_id) |
10 | 9 | rating.saved_value = 0 |
11 | 10 | rating.people_benefited = 0 | ... | ... |
src/noosfero-spb/software_communities/lib/statistic_block.rb
... | ... | @@ -20,13 +20,15 @@ class StatisticBlock < Block |
20 | 20 | end |
21 | 21 | |
22 | 22 | block = self |
23 | + statistics = get_software_statistics | |
23 | 24 | |
24 | 25 | lambda do |object| |
25 | 26 | render( |
26 | 27 | :file => 'blocks/software_statistics', |
27 | 28 | :locals => { |
28 | 29 | :block => block, |
29 | - :total_downloads => downloads.sum | |
30 | + :total_downloads => downloads.sum, | |
31 | + :statistics => statistics | |
30 | 32 | } |
31 | 33 | ) |
32 | 34 | end |
... | ... | @@ -49,4 +51,12 @@ class StatisticBlock < Block |
49 | 51 | downloads.select! {|value| not value.nil? } |
50 | 52 | downloads.sum |
51 | 53 | end |
54 | + | |
55 | + def get_software_statistics | |
56 | + statistics = {} | |
57 | + software = SoftwareInfo.find_by_community_id(self.owner.id) | |
58 | + statistics[:saved_resources] = software.saved_resources | |
59 | + statistics[:benefited_people] = software.benefited_people | |
60 | + statistics | |
61 | + end | |
52 | 62 | end | ... | ... |
src/noosfero-spb/software_communities/views/blocks/software_statistics.html.erb
1 | 1 | <div class="software-metrics-block"> |
2 | 2 | <ul class="metrics-list"> |
3 | 3 | <li> |
4 | - <span class="arrow-globe-icon"></span> | |
5 | - <span id="visit-count"> | |
6 | - <%= pluralize(profile.hits, 'visita', 'visitas') %> | |
7 | - </span> | |
4 | + <span class="arrow-globe-icon"></span> | |
5 | + <span id="visit-count"> | |
6 | + <%= pluralize(profile.hits, 'visita', 'visitas') %> | |
7 | + </span> | |
8 | 8 | </li> |
9 | 9 | <li> |
10 | - <span class="downloads-icon"></span> | |
11 | - <span id="downloads-count"> | |
12 | - <%= pluralize(total_downloads, 'download', 'downloads') %> | |
13 | - </span> | |
10 | + <span class="downloads-icon"></span> | |
11 | + <span id="downloads-count"> | |
12 | + <%= pluralize(total_downloads, 'download', 'downloads') %> | |
13 | + </span> | |
14 | 14 | </li> |
15 | 15 | <li> |
16 | - <span class="face-icon"></span> | |
17 | - <span id="benefited-people"> | |
18 | - <%= block.benefited_people.to_s + _(' benefited people*') %> | |
19 | - </span> | |
16 | + <span class="face-icon"></span> | |
17 | + <span id="benefited-people"> | |
18 | + <%= statistics[:benefited_people].to_s + _(' benefited people*') %> | |
19 | + </span> | |
20 | 20 | </li> |
21 | 21 | <li> |
22 | - <span class="pig-safe-icon"></span> | |
23 | - <span id="saved-resources"> | |
24 | - <strong class="saved-money"> | |
25 | - <%= number_to_currency(block.saved_resources, unit: 'R$ ', | |
26 | - separator: ',', delimiter: '.') %> | |
27 | - </strong> | |
28 | - <%= _(' saved resources*') %> | |
29 | - </span> | |
22 | + <span class="pig-safe-icon"></span> | |
23 | + <span id="saved-resources"> | |
24 | + <strong class="saved-money"> | |
25 | + <%= number_to_currency(statistics[:saved_resources], unit: 'R$ ', | |
26 | + separator: ',', delimiter: '.') %> | |
27 | + </strong> | |
28 | + <%= _(' saved resources*') %> | |
29 | + </span> | |
30 | 30 | </li> |
31 | 31 | </ul> |
32 | 32 | |
33 | 33 | <div class="admin-estimation"> |
34 | - * <%= _("Data estimated by the software administrator.") %> | |
34 | + * <%= _("Data estimated by the software administrator.") %> | |
35 | 35 | </div> |
36 | 36 | </div> | ... | ... |