Commit d49b22888e98829ff3e5c38e38c1a39d671c9c2f
Committed by
Marcos Pereira
1 parent
2cdb8b4f
Exists in
master
and in
1 other branch
Fix interation with organization_ratings plugin
Signed-off-by: Tallys Martins <tallysmartins@gmail.com>
Showing
3 changed files
with
11 additions
and
9 deletions
Show diff stats
src/noosfero-spb/software_communities/lib/ext/search_helper.rb
... | ... | @@ -32,9 +32,9 @@ module SearchHelper |
32 | 32 | |
33 | 33 | def sort_by_average_rating list |
34 | 34 | list.sort! do |a, b| |
35 | - rating_a = OrganizationRating.average_rating(a.id) | |
35 | + rating_a = OrganizationRating.statistics_for_profile(a)[:average] | |
36 | 36 | rating_a = 0 if rating_a.nil? |
37 | - rating_b = OrganizationRating.average_rating(b.id) | |
37 | + rating_b = OrganizationRating.statistics_for_profile(b)[:average] | |
38 | 38 | rating_b = 0 if rating_b.nil? |
39 | 39 | rating_a - rating_b |
40 | 40 | end | ... | ... |
src/noosfero-spb/software_communities/views/organization_ratings_container_extra_fields_show_statistics.html.erb
1 | 1 | <div class="aditional-informations"> |
2 | - <div class="comments-people-benefited"> | |
3 | - <span><%=_("Benefited People")%>:</span> <%= number_with_delimiter(user_rating.people_benefited, ) unless user_rating.nil? %> | |
4 | - </div> | |
2 | + <% unless user_rating.nil? %> | |
3 | + <div class="comments-people-benefited"> | |
4 | + <span><%=_("Benefited People")%>:</span> <%= user_rating.people_benefited.present? ? number_with_delimiter(user_rating.people_benefited) : _(" --- ") %> | |
5 | + </div> | |
5 | 6 | |
6 | - <div class="comments-saved-value"> | |
7 | - <span><%=_("Saved Resources")%>:</span> <%= number_to_currency(user_rating.saved_value) unless user_rating.nil? %> | |
8 | - </div> | |
7 | + <div class="comments-saved-value"> | |
8 | + <span><%=_("Saved Resources")%>:</span> <%= user_rating.saved_value.present? ? number_to_currency(user_rating.saved_value) : _(" --- ") %> | |
9 | + </div> | |
10 | + <% end %> | |
9 | 11 | </div> |
10 | 12 | ... | ... |
src/noosfero-spb/software_communities/views/shared/_organization_average_rating_block.html.erb
1 | 1 | <div class="star-container catalog_rating_block"> |
2 | 2 | <% (1..5).each do |rate_number| %> |
3 | - <% if rate_number <= OrganizationRating.average_rating(community.id) %> | |
3 | + <% if rate_number <= OrganizationRating.statistics_for_profile(community)[:average] %> | |
4 | 4 | <div class="medium-star-positive"></div> |
5 | 5 | <% else %> |
6 | 6 | <div class="medium-star-negative"></div> | ... | ... |