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 the org post count issue #19503

Merged
merged 7 commits into from
May 24, 2023
Merged

Fix the org post count issue #19503

merged 7 commits into from
May 24, 2023

Conversation

aneshodza
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

This pull request is just here to fix #19456. I added a regression spec and also a spec to check if the correct amount is displayed at all. The regression spec should be enough, but I'm happy to write more if that's needed.

Related Tickets & Documents

QA Instructions, Screenshots, Recordings

You can run the specific specs that I added by running following commands in your terminal:

bundle exec rspec spec/system/organization/user_views_an_organization_spec.rb:33
bundle exec rspec spec/system/organization/user_views_an_organization_spec.rb:37

The org page should now display the correct number:
image

UI accessibility concerns?

The accessibility shouldn't be impacted, even if this change is for the UI.

Added/updated tests?

  • Yes, added regression tests
  • No, and this is why: please replace this line with details on why tests
    have not been included
  • I need help with writing tests

@aneshodza aneshodza requested a review from a team as a code owner May 19, 2023 10:41
@aneshodza aneshodza requested review from jaw6 and filleduchaos and removed request for a team May 19, 2023 10:41
@github-actions
Copy link
Contributor

Thank you for opening this PR! We appreciate you!

For all pull requests coming from third-party forks we will need to
review the PR before we can process it through our CI pipelines.

A Forem Team member will review this contribution and get back to
you as soon as possible!

Copy link
Contributor

@benhalpern benhalpern left a comment

Choose a reason for hiding this comment

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

Needs to only show published, added the suggestion. Thanks for the PR!

Copy link
Contributor

@jaw6 jaw6 left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this! And thanks for fixing this bug! I have a couple of ideas of how we can make this work a bit better, but we're very much on the right track.

app/views/organizations/_sidebar.html.erb Outdated Show resolved Hide resolved
@@ -30,6 +30,16 @@
end
end

it "shows the right amount of articles in sidebar" do
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure we need two tests here — the other is a super-set of what's being tested here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It just feels more intuitive to have the happy path and the edge-case tested in separate tests. If you think it's unnecessary I can remove it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's fine either way, but you could also condense them into a single example that tests different numbers of posts so it feels less arbitrary

@aneshodza aneshodza requested review from jaw6 and benhalpern May 19, 2023 14:04
Copy link
Contributor

@jaw6 jaw6 left a comment

Choose a reason for hiding this comment

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

Thanks again for fixing this bug! I think this is moving in the right direction, I noticed a couple of things that could make it even better.

spec/models/organization_spec.rb Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented May 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +26.90 🎉

Comparison is base (a5842bd) 58.60% compared to head (84fadfd) 85.51%.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #19503       +/-   ##
===========================================
+ Coverage   58.60%   85.51%   +26.90%     
===========================================
  Files        1163     1155        -8     
  Lines       29593    25991     -3602     
  Branches     1887     1832       -55     
===========================================
+ Hits        17344    22225     +4881     
+ Misses      12062     3568     -8494     
- Partials      187      198       +11     
Flag Coverage Δ
cypress 68.77% <ø> (-1.35%) ⬇️
javascript 68.77% <ø> (-1.35%) ⬇️
ruby 92.67% <100.00%> (+38.31%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
app/models/organization.rb 98.03% <100.00%> (+2.03%) ⬆️

... and 601 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@aneshodza aneshodza requested a review from a team as a code owner May 23, 2023 19:55
@aneshodza aneshodza requested review from maestromac and removed request for a team May 23, 2023 19:55
@benhalpern
Copy link
Contributor

@maestromac any idea why the Build PR Image check is failing?

@maestromac
Copy link
Contributor

@benhalpern Yup I am addressing that now

@github-actions
Copy link
Contributor

github-actions bot commented May 24, 2023

Uffizzi Preview deployment-26473 was deleted.

Copy link
Contributor

@filleduchaos filleduchaos left a comment

Choose a reason for hiding this comment

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

One more thing though - did you sign the CLA when you opened this PR? I was fairly sure I saw that you did, but it's not showing up in the PR checks 🤔 you can check whether you've signed or not here

@aneshodza
Copy link
Contributor Author

One more thing though - did you sign the CLA when you opened this PR? I was fairly sure I saw that you did, but it's not showing up in the PR checks 🤔 you can check whether you've signed or not here

Yes, I did. It should be visible in the checks (it's the last one):
image

@benhalpern benhalpern merged commit 772f6cd into forem:main May 24, 2023
32 checks passed
jaw6 added a commit that referenced this pull request May 25, 2023
…tor_after_suggest

* origin/main:
  Fix the org post count issue (#19503)
  Fix styling for long org promoted billboard (#19528)
  Revert Uffizzi refactors (#19526)
jaw6 added a commit that referenced this pull request May 26, 2023
* origin/main:
  Manual Audience Segments API write endpoints (#19476)
  Refactoring onboarding (#19525)
  Fix the org post count issue (#19503)
  Fix styling for long org promoted billboard (#19528)
  Revert Uffizzi refactors (#19526)
dukegreene pushed a commit that referenced this pull request Jun 1, 2023
* Fix the org post count issue

* Add regression specs

* Move things around and sort them better

* Implement PR review

* Revert accidental changes

---------

Co-authored-by: Mac Siri <mac@forem.com>
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.

Org page showing wrong number of posts.
5 participants