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

added total contributors for all time #3695

Merged
merged 4 commits into from Oct 26, 2018
Merged

added total contributors for all time #3695

merged 4 commits into from Oct 26, 2018

Conversation

ghost
Copy link

@ghost ghost commented Oct 13, 2018

Fixes #3499

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • ask @publiclab/reviewers for help, in a comment below

@ghost ghost changed the title added total contributors for all time [WIP ]added total contributors for all time Oct 13, 2018
@ghost ghost changed the title [WIP ]added total contributors for all time [WIP]added total contributors for all time Oct 13, 2018
@ghost
Copy link
Author

ghost commented Oct 13, 2018

r? @jywarren @sagarpreet-chadha @SidharthBansal @publiclab/mentors

I'm facing this "Unescaped model attribute" issue in the test case. I have never used Ruby I18n in the views. Please help me to resolve this issue.

I need some help in catching this query, I'm not sure, how should I proceed!
Thanks :)

@plotsbot
Copy link
Collaborator

plotsbot commented Oct 13, 2018

2 Messages
📖 @kanikashrivastav Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution! And don’t be discouraged if you see errors – we’re here to help.
📖 Pull Request is marked as Work in Progress

Generated by 🚫 Danger

@jywarren
Copy link
Member

Ah, this is a style or security warning, let me check!

@jywarren
Copy link
Member

Aha, I've approved it and you are ok now.

I think this may need some caching to not cause trouble... Perhaps someone from @publiclab/mentors with experience in caching could help you set up a daily cache? You can also search the codebase for examples of caching in views.

Great work here! Just a few more steps!

@@ -81,5 +81,6 @@ def index

@all_notes = nids.uniq.length
@all_contributors = users.uniq.length
@all_time_contributors = User.count_all_time_contributor
Copy link
Member

Choose a reason for hiding this comment

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

cache could wrap this line

@jywarren
Copy link
Member

Hi! Just looking to see if I can help you get a cache installed here too. One way to do it is a cache in the controller, so it doesn't get generated too often. So that would like kind of like:

Rails.cache.fetch("front-activity", expires_in: 30.minutes) do
activity
end

It does need a unique key, so you could put total-contributors-all-time instead of front-activity -- and set the expiration to... weekly? For now? So 1.weeks

Then we should add, after the number is shown in the template, a note like (tallied weekly) so that people know that it may not be /totally/ up to date. We can shorten this to daily if we think it works well.

You can put the caching around the line marked in my other comment.

More caching docs are here: https://api.rubyonrails.org/classes/ActiveSupport/Cache/Store.html

I hope this helps!

@ghost
Copy link
Author

ghost commented Oct 25, 2018

r? @jywarren @sagarpreet-chadha @SidharthBansal I think this should work fine now :)

Copy link
Contributor

@sagarpreet-chadha sagarpreet-chadha left a comment

Choose a reason for hiding this comment

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

Awesome !!!
Can you post a screenshot ? Thanks !

Copy link
Member

@SidharthBansal SidharthBansal left a comment

Choose a reason for hiding this comment

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

Well done

@ghost ghost changed the title [WIP]added total contributors for all time added total contributors for all time Oct 26, 2018
@jywarren
Copy link
Member

Very well done, thank you!!! 👍 🎉

We'd love your help with a new project if you're interested!!!

@jywarren jywarren merged commit 4f028aa into publiclab:master Oct 26, 2018
@jywarren
Copy link
Member

Perhaps this one would be interesting? We'd very much like to solve it: #1097

SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this pull request May 5, 2019
* added total contributors for all time

* fixes linting issues

* Added Cache to all time contributors

* Changed the stats view template
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants