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 request comments count #4235

Merged
merged 8 commits into from
Aug 1, 2024

Conversation

wendyyang
Copy link
Contributor

@wendyyang wendyyang commented Jul 26, 2024

Closes #

Changes proposed in this pull request

add method in Model request to get all comments associated to the request.

replace existing one which only count the comment for the request, but not associated receptacle & labware comments in the view.

Instructions for Reviewers

[All PRs] - Confirm PR template filled
[Feature Branches] - Review code
[Production Merges to main]
    - Check story numbers included
    - Check for debug code
    - Check version

@wendyyang wendyyang linked an issue Jul 26, 2024 that may be closed by this pull request
Copy link

codecov bot commented Jul 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (develop@f90596c). Learn more about missing BASE report.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #4235   +/-   ##
==========================================
  Coverage           ?   86.79%           
==========================================
  Files              ?     1369           
  Lines              ?    29746           
  Branches           ?        0           
==========================================
  Hits               ?    25817           
  Misses             ?     3929           
  Partials           ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

codeclimate bot commented Jul 26, 2024

Code Climate has analyzed commit 174c98b and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 86.7%.

View more on Code Climate.

@wendyyang wendyyang marked this pull request as ready for review July 31, 2024 08:09
@wendyyang wendyyang changed the title change the comments count to include asset comment Fix the request comments count Jul 31, 2024
def self.get_all_comments(request)
counts = Comment.counts_for_requests([request])
counts[request.id]
end
Copy link
Contributor

Choose a reason for hiding this comment

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

Handy that this counts_for_requests method existed already! Looks like that's used for a similar link on the Pipeline inbox page, e.g. here - https://training.sequencescape.psd.sanger.ac.uk/pipelines/51

@@ -494,4 +494,21 @@
expect(subject[request_type2].started).to eq(1)
end
end

describe '.get_all_comments' do
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
describe '.get_all_comments' do
describe '#get_all_comments' do

I was going to say that this is the convention elsewhere in Sequencescape. But it looks like we've got both!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I did see both and not sure what is the difference. if they are the same, look like using '#' is more than '.'

Copy link
Member

@yoldas yoldas Aug 1, 2024

Choose a reason for hiding this comment

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

'.' is for class methods. '#' is for instance methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in this case, I should use '.' then?

Copy link
Member

Choose a reason for hiding this comment

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

The signature self.get_all_comments(request) shows it is a class method. Test for this method by convention will have a '.' prefix.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, thanks! will change back my initial one.

Copy link
Contributor

@KatyTaylor KatyTaylor left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Copy link
Contributor

@dasunpubudumal dasunpubudumal left a comment

Choose a reason for hiding this comment

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

Looks good 👍🏼

app/models/request.rb Show resolved Hide resolved
@wendyyang wendyyang merged commit c57a789 into develop Aug 1, 2024
23 checks passed
@wendyyang wendyyang deleted the 4107-y24-077-comments-not-fully-displayed branch August 1, 2024 10:00
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.

Y24-077 Comments not fully displayed
4 participants