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

5514 – Import fact-check as published report #2094

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

vasconsaurus
Copy link
Contributor

@vasconsaurus vasconsaurus commented Oct 16, 2024

Description

Context

While trying to run a fact check import Jessie noted that the fact checks weren't imported as published.
I looked at some older imports and seems to have been the case for a while even though we set fc.publish_report = true in the FetchBot.

What

We were updating the published value for Dynamic but weren't for FactCheck. We hadn't implemented that as part of the big articles work.

So we just need to make sure both are updated as published when importing through the FetchBot.

References: 5390, 5514

How has this been tested?

rails test test/models/bot/fetch_test.rb:257

Things to pay attention to during code review

Please describe parts of the change that require extra attention during code review, for example:

  • File FFFF, line LL: This refactoring does this and this. Is it consistent with how it’s implemented elsewhere?
  • Etc.

Checklist

  • I have performed a self-review of my own code
  • I have added unit and feature tests, if the PR implements a new feature or otherwise would benefit from additional testing
  • I have added regression tests, if the PR fixes a bug
  • I have added logging, exception reporting, and custom tracing with any additional information required for debugging
  • I considered secure coding practices when writing this code. Any security concerns are noted above.
  • I have commented my code in hard-to-understand areas, if any
  • I have made needed changes to the README
  • My changes generate no new warnings
  • If I added a third party module, I included a rationale for doing so and followed our current guidelines

@vasconsaurus
Copy link
Contributor Author

@caiosba @melsawy could you take a look?

Made a draft PR so it's easier to discuss.

@caiosba
Copy link
Contributor

caiosba commented Oct 16, 2024

thanks @vasconsaurus - in theory, publish_report = true should still work, but probably some other change would be required... this was probably a regression from all the articles work (AFAIR, we didn't test manually-importing things with our script). But if tests pass and importing works, this change LGTM - it's consistent with the data model.

@vasconsaurus
Copy link
Contributor Author

@caiosba It should work, that is why I'm unsure on this one.. I'll do some more poking around today and see what I can find. Yesterday I did stick a byebug inside update_report, and it seemed to not get to it when running publish_report = true, it did when I changed it.

Anyway! Will double check and come back.

@vasconsaurus
Copy link
Contributor Author

@caiosba still will look some more into this after lunch, but for now:

It seems Dynamic is updated correctly to published, but the FactCheck.report_status is never changed.

(byebug) Dynamic.last
#<Dynamic id: 272, annotation_type: "report_design", ... , data: {"options"=>{ ... "state"=>"published"}, ... >
(byebug) FactCheck.last
#<FactCheck ... report_status: "unpublished"... >

Also, we set unpublished_state to unpublished and data[:state] to published. After setting data[:state] to published should unpublished_state still remain as unpublished?

unpublished_state = data[:state].blank? ? 'unpublished' : 'paused'
data[:state] = (self.publish_report ? 'published' : unpublished_state) if data[:state].blank? || !self.publish_report.nil?

@caiosba
Copy link
Contributor

caiosba commented Oct 17, 2024

Ah, that actually makes sense, @vasconsaurus ... we simply haven't implemented that as part of the big articles work. I think we're good as far as debugging is concerned. Just one question... I don't know if the solution is...

(1) Replace the current line fc.publish_report = true by fc.report_status = "published" like you did

(2) In addition to the current line fc.publish_report = true, add a line fc.report_status = "published"

At the end of the day, we need to be sure that both the fact-check and the report have the status "published".

both fact-check and dynamic status should be published
We need to be sure that both the fact-check and the report have the status "published".
@vasconsaurus vasconsaurus changed the title [WIP] Import a fact check as published report Import a fact check as published report Oct 17, 2024
@vasconsaurus vasconsaurus marked this pull request as ready for review October 17, 2024 16:12
@vasconsaurus vasconsaurus changed the title Import a fact check as published report Import fact-check as published report Oct 17, 2024
@vasconsaurus vasconsaurus changed the title Import fact-check as published report 5514 – Import fact-check as published report Oct 17, 2024
Copy link
Contributor

@caiosba caiosba left a comment

Choose a reason for hiding this comment

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

Thanks, @vasconsaurus ! Did the test fail before the fix?

@vasconsaurus
Copy link
Contributor Author

@caiosba

Screenshot 2024-10-17 at 13 26 51

@caiosba
Copy link
Contributor

caiosba commented Oct 17, 2024

@caiosba

Screenshot 2024-10-17 at 13 26 51

AMAZING, TDD FTW

@vasconsaurus vasconsaurus merged commit be0c10e into develop Oct 17, 2024
11 checks passed
@vasconsaurus vasconsaurus deleted the 5390-import-and-publish-fc branch October 17, 2024 18:22
caiosba pushed a commit that referenced this pull request Oct 18, 2024
While trying to run a fact check import Jessie noted that the fact checks weren't imported as published.
I looked at some older imports and seems to have been the case for a while even though we set fc.publish_report = true in the FetchBot.

We were updating the published value for Dynamic but weren't for FactCheck. We hadn't implemented that as part of the big articles work. So we just need to make sure both are updated as published when importing through the FetchBot.

References: 5390, 5514
PR: 2094
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