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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update tag_controller.rb #8221

Merged
merged 2 commits into from Sep 1, 2020
Merged

Update tag_controller.rb #8221

merged 2 commits into from Sep 1, 2020

Conversation

yusufatalay
Copy link
Contributor

@yusufatalay yusufatalay commented Jul 31, 2020

replaced the instances of .count and .length with .size

Fixes #8209

Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • PR is descriptively titled 馃搼 and links the original issue above 馃敆
  • 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 馃搧
  • screenshots/GIFs are attached 馃搸 in case of UI updation
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

Thanks!

replaced the instances of .count and .length with .size
@welcome
Copy link

welcome bot commented Jul 31, 2020

Thanks for opening this pull request! This space is protected by our Code of Conduct - and we're here to help.
Dangerbot will test out your code and reply in a bit with some pointers and requests.
Also please refer here for installation help 馃捒
There may be some errors, but don't worry! We'll work through them with you! 馃憤馃帀馃槃
It would be great if you can tell us your Twitter handle so we can thank you properly?

@gitpod-io
Copy link

gitpod-io bot commented Jul 31, 2020

@yusufatalay
Copy link
Contributor Author

I've done my task.Thank you for giving me the oppurtunity to do this. can you rewiev the code and give some feedback to me ?.

@codecov
Copy link

codecov bot commented Jul 31, 2020

Codecov Report

Merging #8221 into main will increase coverage by 0.05%.
The diff coverage is 83.80%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #8221      +/-   ##
==========================================
+ Coverage   81.81%   81.87%   +0.05%     
==========================================
  Files         100      101       +1     
  Lines        5846     5902      +56     
==========================================
+ Hits         4783     4832      +49     
- Misses       1063     1070       +7     
Impacted Files Coverage 螖
app/controllers/users_controller.rb 81.11% <酶> (-1.06%) 猬囷笍
app/mailers/admin_mailer.rb 90.90% <0.00%> (酶)
app/controllers/spam2_controller.rb 71.84% <44.44%> (-3.76%) 猬囷笍
app/models/comment.rb 77.51% <50.00%> (酶)
app/controllers/notes_controller.rb 83.40% <83.33%> (-0.01%) 猬囷笍
app/controllers/tag_controller.rb 81.45% <83.33%> (+0.11%) 猬嗭笍
app/models/user.rb 87.68% <85.71%> (酶)
app/controllers/batch_controller.rb 90.19% <90.19%> (酶)
app/controllers/wiki_controller.rb 85.34% <92.30%> (+0.34%) 猬嗭笍
app/controllers/admin_controller.rb 80.24% <100.00%> (酶)
... and 11 more

@cesswairimu
Copy link
Collaborator

thanks so much @yusufatalay for opening this 馃帀 could you please add the issue link to the issue this pull request fixes on your pull request on this line "Fixes issue_link" this will help other contributors while reviewing your changes. It also helps in automatically closing the issue when the pull request is merged. Thanks

@cesswairimu
Copy link
Collaborator

@yusufatalay please update the link to the issue you are solving. Thanks

@yusufatalay
Copy link
Contributor Author

yusufatalay commented Aug 10, 2020

I am confused can you walk me through it ?

@avats-dev
Copy link
Member

I am confused can you walk me through it ?

Hey @yusufatalay , thanks for your contribution and welcome to publiclab community. It's very important to link your PR to the issue that it intends to resolve, as this can:

  • help others check if PR is any good for what it is intended.
  • automatically close that issue when the PR is merged.
  • help in better workflow of the codebase.

To link your PR to the issue, edit your comment (the first one, i.e. one with which you have opened this PR) and you'll see something like "Fixes #0000 (<=== Add issue number here)". This is even the first line of your comment. You have to replace 0000 here with the issue number concerned with your PR, and leave everything else as it is. Don't remove the # as it is crucial and creates the link in between.

If you're still unsure and having problems, watch this as an example.
Peek 2020-08-22 23-58

Copy link
Member

@avats-dev avats-dev left a comment

Choose a reason for hiding this comment

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

@yusufatalay , nice work. There're remaining instances of .count still in

def fetch_counts
# Enhancement #6306 - Add counts to `by type` dropdown on tag pages
@counts = {}
@counts[:posts] = Node.for_tagname_and_type(params[:id], 'note', wildcard: @wildcard).where('node.nid NOT IN (?)', @qids).count
@counts[:questions] = Node.for_tagname_and_type(params[:id], 'note', question: true, wildcard: @wildcard).where('node.nid IN (?)', @qids).count
@counts[:wiki] = Node.for_tagname_and_type(params[:id], 'page', wildcard: @wildcard).count
params[:counts] = @counts
# end Enhancement #6306 ============================================
@total_posts = case @node_type
when 'note'
@notes.count
when 'questions'
@questions.count
when 'wiki'
@wikis.count
when 'maps'
@nodes.count
end
end
end

and similarly I've seen that there are some remaining instances of .length also in code.

TIP: Use Ctrl+F after you've done editing and search for .count and .length keywords to see if there're any.
CAUTION: There're chances that similar keywords are present like counts or even the count word in some variable or string. You should not edit them. I think these would be rare, if you search with the . in front.

Thanks, keep up the good work! 馃憤

@avats-dev
Copy link
Member

Hey @yusufatalay , you've linked this PR with your PR, while you need to link the concerned issue to this PR. I checked and saw that the issue concerned with your PR is #8209. So, your comment should be like "Fixes #8209".

Thanks, good work. 馃憤

@avats-dev
Copy link
Member

Also, @cesswairimu , review this when you're free.

@yusufatalay
Copy link
Contributor Author

Thank you for guiding me it really helps me improve myself. Those .counts must be added after I edit the code , if not please let me know.

@avats-dev
Copy link
Member

Hey @yusufatalay , these instances are not added after you've edited the code as these are also present in your fork https://github.com/yusufatalay/plots2/blob/patch-1/app/controllers/tag_controller.rb.

Now, you should checkout to your patch-1 branch and edit the changes needed. After that just commit and push the changes to your branch, and this PR will get updated itself.

Feel free to ping back if you're stuck or need any help. 馃憤

@yusufatalay
Copy link
Contributor Author

I figure it out that on github ctrl+f won't work for whole code. So I copied it to a text editor then I've edited it there thank you for your help , I've learned alot from this.

@avats-dev
Copy link
Member

I figure it out that on github ctrl+f won't work for whole code. So I copied it to a text editor then I've edited it there thank you for your help , I've learned alot from this.

@yusufatalay it's good to hear that you learnt a lot. Could you push your changes so that we can review it?

You've to push changes on this branch, then only this PR would self update itself.

Thanks 馃憤

Copy link
Member

@avats-dev avats-dev left a comment

Choose a reason for hiding this comment

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

Looks all good now @yusufatalay . 馃帀 Thanks for the contribution.

@cesswairimu for review and merge!

@avats-dev
Copy link
Member

@yusufatalay close #8360, as this PR is gonna solve the issue and would be merged hopefully! Thanks

@avats-dev avats-dev mentioned this pull request Aug 30, 2020
5 tasks
@avats-dev
Copy link
Member

@yusufatalay don't close this PR, this is good and it's working. Also tests have passed. Reopen this PR.

Close #8360, the new one that you've opened.

@yusufatalay yusufatalay reopened this Aug 30, 2020
@gitpod-io
Copy link

gitpod-io bot commented Aug 30, 2020

Copy link
Member

@avats-dev avats-dev left a comment

Choose a reason for hiding this comment

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

Looks all good to me 馃帀

@cesswairimu check this one and merge when you're free!

@yusufatalay
Copy link
Contributor Author

Thank you for patiently teaching me.

@cesswairimu
Copy link
Collaborator

Really love the collaboration that has gone on here . Great job 馃帀 馃帀

Copy link
Collaborator

@cesswairimu cesswairimu left a comment

Choose a reason for hiding this comment

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

馃殌

@cesswairimu cesswairimu merged commit c229df4 into publiclab:main Sep 1, 2020
@cesswairimu
Copy link
Collaborator

Welcome to the community @yusufatalay 馃巿

@welcome
Copy link

welcome bot commented Sep 1, 2020

Congrats on merging your first pull request! 馃檶馃帀鈿★笍
Your code will likely be published to PublicLab.org in the next few days, but first it will be published to https://stable.publiclab.org/ (it will take some minutes for this to load, and until then you may see logs from the build process). Please test out your work on this testing server and report back with a comment that all has gone well!
Do join our weekly check-in to share your this week goal and the awesome work you did 馃槂. Please find the link pinned in the issue section 馃摑
Now that you've completed this, you can help someone else take their first step!
Reach out to someone else working on theirs on Public Lab's code welcome page (where you'll now be featured as a recent contributor!). Thanks!

Help others take their first step

Now that you've merged your first pull request, you're the perfect person to help someone else out with this challenging first step. 馃檶

https://code.publiclab.org

Try looking at this list of `first-timers-only` issues, and see if someone else is waiting for feedback, or even stuck! 馃槙

People often get stuck at the same steps, so you might be able to help someone get unstuck, or help lead them to some documentation that'd help. Reach out and be encouraging and friendly! 馃槃 馃帀

Read about how to help support another newcomer here, or find other ways to offer mutual support here.

@avats-dev
Copy link
Member

Welcome to the community @yusufatalay 馃殌 and thanks @cesswairimu 馃槃

nadimakhtar97 pushed a commit to nadimakhtar97/plots2 that referenced this pull request Sep 21, 2020
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
shubhangikori pushed a commit to shubhangikori/plots2 that referenced this pull request Oct 12, 2020
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
alvesitalo pushed a commit to alvesitalo/plots2 that referenced this pull request Oct 14, 2020
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
piyushswain pushed a commit to piyushswain/plots2 that referenced this pull request Oct 22, 2020
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
manchere pushed a commit to manchere/plots2 that referenced this pull request Feb 13, 2021
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
lagunasmel pushed a commit to lagunasmel/plots2 that referenced this pull request Mar 2, 2021
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
reginaalyssa pushed a commit to reginaalyssa/plots2 that referenced this pull request Oct 16, 2021
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
ampwang pushed a commit to ampwang/plots2 that referenced this pull request Oct 26, 2021
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
billymoroney1 pushed a commit to billymoroney1/plots2 that referenced this pull request Dec 28, 2021
* Update tag_controller.rb

replaced the instances of .count and .length with .size

* Update tag_controller.rb
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.

Replace .count and .length in the tag controller with .size
3 participants