[gnome-software/wip/temp/ubuntu-xenial-rebased: 44/326] Show review histogram
- From: Iain Lane <iainl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/temp/ubuntu-xenial-rebased: 44/326] Show review histogram
- Date: Fri, 29 Apr 2016 09:51:01 +0000 (UTC)
commit ace16bb50ba9f36247aeeeae54fea5ba536fc4bb
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 e4f1345..1393ea2 100644
--- a/src/plugins/gs-plugin-ubuntu-reviews.c
+++ b/src/plugins/gs-plugin-ubuntu-reviews.c
@@ -556,10 +556,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;
@@ -590,7 +595,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]