[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 44/331] Show review histogram



commit fe483aa6f314ea803f9617e7f580bbb0f2151325
Author: Robert Ancell <robert ancell canonical com>
Date:   Tue Feb 9 15:33:57 2016 +1300

    Show review histogram

 src/gs-shell-details.c                 |    1 +
 src/plugins/gs-plugin-ubuntu-reviews.c |   19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index dc6c926..34c5453 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -607,6 +607,7 @@ gs_shell_details_refresh_all (GsShellDetails *self)
        const gchar *tmp;
        gboolean ret;
        gchar **menu_path;
+       guint count1, count2, count3, count4, count5;
        guint64 kudos;
        guint64 updated;
        guint64 user_integration_bf;
diff --git a/src/plugins/gs-plugin-ubuntu-reviews.c b/src/plugins/gs-plugin-ubuntu-reviews.c
index 626f1fb..5f2d98d 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -557,10 +557,15 @@ get_rating_sqlite_cb (void *data,
 }
 
 static gboolean
-get_rating (GsPlugin *plugin,
-           const gchar *package_name,
-           gint *rating,
-           GError **error)
+get_review_stats (GsPlugin *plugin,
+                 const gchar *package_name,
+                 gint *rating,
+                 guint *count1,
+                 guint *count2,
+                 guint *count3,
+                 guint *count4,
+                 guint *count5,
+                 GError **error)
 {
        Histogram histogram = { 0, 0, 0, 0, 0 };
        gchar *error_msg = NULL;
@@ -591,7 +596,11 @@ get_rating (GsPlugin *plugin,
                *rating = -1;
        else
                *rating = ((histogram.one_star_count * 20) + (histogram.two_star_count * 40) + 
(histogram.three_star_count * 60) + (histogram.four_star_count * 80) + (histogram.five_star_count * 100)) / 
n_ratings;
-g_warning ("%s %zi %zi %zi %zi %zi / %d -> %d", package_name, histogram.one_star_count, 
histogram.two_star_count, histogram.three_star_count, histogram.four_star_count, histogram.five_star_count, 
n_ratings, *rating);
+       *count1 = histogram.one_star_count;
+       *count2 = histogram.two_star_count;
+       *count3 = histogram.three_star_count;
+       *count4 = histogram.four_star_count;
+       *count5 = histogram.five_star_count;
 
        return TRUE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]