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

exclude subjects still linked to set_member_subject in subject_remover #4306

Merged
merged 9 commits into from
Mar 27, 2024

Conversation

Tooyosi
Copy link
Contributor

@Tooyosi Tooyosi commented Mar 15, 2024

Describe your change here.

Review checklist

  • First, the most important one: is this PR small enough that you can actually review it? Feel free to just reject a branch if the changes are hard to review due to the length of the diff.
  • If there are any migrations, will they the previous version of the app work correctly after they've been run (e.g. the don't remove columns still known about by ActiveRecord).
  • If anything changed with regards to the public API, are those changes also documented in the apiary.apib file?
  • Are all the changes covered by tests? Think about any possible edge cases that might be left untested.

@Tooyosi Tooyosi requested review from zwolf and lcjohnso March 15, 2024 18:16
@zwolf zwolf requested review from yuenmichelle1 and removed request for zwolf March 19, 2024 16:28
@yuenmichelle1
Copy link
Collaborator

Related to: #4250

Copy link
Collaborator

@yuenmichelle1 yuenmichelle1 left a comment

Choose a reason for hiding this comment

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

Hey Toyosi!

Apologies for the late review. Overall this looks good. I think the biggest thing is

  • the TypeError added in remover.rb in order to get your tests to pass. I think the reason you've encountered this error in your specs lies possibly with how we are stubbing.

spec/workers/subject_removal_worker_spec.rb Outdated Show resolved Hide resolved
def stub_discussions_request(subject_id)
stub_request(:get, discussions_url)
.with(query: { focus_id: subject_id, focus_type: 'Subject' })
.to_return(status: 200, body: '[]', headers: {})
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe the reason you are getting (and catching) TypeErrors when reaching remover.rb's has_been_talked_about? (L68 of remover.rb) is because your stubbed response does not match that of the panoptes talk client.

Suggested change
.to_return(status: 200, body: '[]', headers: {})
.to_return(status: 200, body: '{"discussions": []}', headers: {})

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wow, thanks. I had no idea the response

@@ -56,11 +59,19 @@ def has_been_collected_or_classified?
!orphan_subject
end

def belongs_to_other_subject_set?
return false unless subject_set_id != nil
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
return false unless subject_set_id != nil
return false unless !subject_set_id.nil?

lib/subjects/remover.rb Outdated Show resolved Hide resolved
spec/workers/subject_removal_worker_spec.rb Outdated Show resolved Hide resolved
@Tooyosi Tooyosi requested a review from yuenmichelle1 March 27, 2024 04:55
@Tooyosi Tooyosi merged commit 818e0d3 into master Mar 27, 2024
8 checks passed
@Tooyosi Tooyosi deleted the issue/4250-subject-set-remover branch March 27, 2024 17:32
@Tooyosi Tooyosi restored the issue/4250-subject-set-remover branch March 27, 2024 17:32
@Tooyosi Tooyosi deleted the issue/4250-subject-set-remover branch March 27, 2024 17:32
@Tooyosi Tooyosi restored the issue/4250-subject-set-remover branch April 12, 2024 16:57
@Tooyosi Tooyosi deleted the issue/4250-subject-set-remover branch April 12, 2024 16:58
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.

2 participants