Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix geozone population stats #1939

Merged
merged 4 commits into from
Apr 4, 2019
Merged

Fix geozone population stats #1939

merged 4 commits into from
Apr 4, 2019

Conversation

javierm
Copy link

@javierm javierm commented Mar 19, 2019

References

Objectives

Fix geozone population stats. Currently we calculate the participation percentage related to the registered users from a geozone. However, we need to compare against the geozone population.

Currently, geozones don't store population information. So for polls we won't display this percentage, and for budgets we'll use the information stored in the headings.

Does this PR need a Backport to CONSUL?

Yes, backport when we backport everything related to stats.

@javierm javierm force-pushed the geozone_stats branch 2 times, most recently from 8ddc868 to 4369391 Compare March 19, 2019 18:25
@javierm javierm changed the title [WIP] Fix geozone population stats Fix geozone population stats Mar 19, 2019
@javierm javierm force-pushed the show_only_existing_stats branch from a1e6553 to 42aa13f Compare March 19, 2019 19:28
@javierm javierm force-pushed the geozone_stats branch 3 times, most recently from 786cb77 to 38e783a Compare March 19, 2019 21:17
@javierm javierm force-pushed the show_only_existing_stats branch from 38f3163 to c695ca7 Compare March 20, 2019 12:42
@javierm javierm force-pushed the show_only_existing_stats branch from 35bd318 to 6c23b41 Compare March 20, 2019 14:37
@javierm javierm force-pushed the show_only_existing_stats branch from 6c23b41 to bbb2b84 Compare March 20, 2019 21:07
@javierm javierm force-pushed the show_only_existing_stats branch from bbb2b84 to 40457b5 Compare March 26, 2019 11:15
@javierm javierm force-pushed the show_only_existing_stats branch 2 times, most recently from 2b22c12 to 1c55447 Compare April 3, 2019 17:13
@javierm javierm changed the base branch from show_only_existing_stats to stats April 3, 2019 18:09
@javierm javierm force-pushed the geozone_stats branch 2 times, most recently from e1472be to cccf3b2 Compare April 3, 2019 18:13
javierm added 3 commits April 3, 2019 21:11
We currently don't store geozone population.
Even if this class looks very simple now, we're trying a few things
related to these stats. Having a class for it makes future changes
easier and, if there weren't any future changes, at least it makes
current experiments easier.

Note we keep the method `participants_by_geozone` to return a hash
because we're caching the stats and storing GeozoneStats objects would
need a lot more memory and we would get an error.
If there's demographic data for all participants, it doesn't make sense
to show the message.

We're using translations instead of an `if` in the view because the text
is also different when there's only one participant. In some languages
the text might also be different depending on how many people with no
demographic data participated.

Another possibility would be to use an `if` in the view so we don't
display an empty paragraph when the cont is zero, and then using
translation for `one` and `other`. I haven't gone that way because I
thought the logic would be more complex and the benefits wouldn't be
that great.
Copy link

@voodoorai2000 voodoorai2000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

@javierm javierm merged this pull request into stats Apr 4, 2019
@javierm javierm deleted the geozone_stats branch April 4, 2019 16:13
@javierm javierm mentioned this pull request Apr 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants