Skip to content

Conversation

@hlbmtc
Copy link
Contributor

@hlbmtc hlbmtc commented Nov 29, 2024

Revisited auto-close logic for conditional questions:

  • Added PredictionStatusMessage: it refactors Forecast Maker predictionMessage component and generates status message JSX instead of string lang.
  • Fixed Post.set_actual_close_time logic for conditional questions: not it auto-closes parent if Condition OR Child was closed
  • Fixed PostReadSerialize.get_status generation. Now it respects actual_close_time dates
  • Configured pytest to reuse db
  • Extra unit tests

TODO:

  • Write a local migration to close all questions where conditional parent was resolved, but child is still active
  • Apply ad-hoc script on prod

closes #1008

- Fixed unit tests
@hlbmtc hlbmtc marked this pull request as ready for review December 2, 2024 18:12
Comment on lines +50 to +53
{t("predictionConditionalPartiallyClosedMessage", {
closedQuestion: closedQuestion.title,
activeQuestion: activeQuestion.title,
})}
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think there should ever be a state where there is one close and one open branch?
What situation are you imagining?

Copy link
Contributor

Choose a reason for hiding this comment

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

If we're already in the PostStatus.CLOSED situation, then how would there be an active branch question?

Copy link
Contributor

Choose a reason for hiding this comment

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

This just seems like unreachable code, so not blocking, just unnecessary

Copy link
Contributor Author

@hlbmtc hlbmtc Dec 2, 2024

Choose a reason for hiding this comment

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

@lsabor
It's not about Yes/No branches, but condition parent and condition child.
We have an example of this -- https://www.metaculus.com/questions/22051/starship-booster-tower-catch-attempt-in-2024/

#1008

Copy link
Contributor

Choose a reason for hiding this comment

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

Good tests

This might be asking you to do my work for me, but it would be great to have tests for "unresolve" parent / child actions as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. I added a test case base, so you could expand it in the future. Though, I probably found a bug:
https://github.com/Metaculus/metaculus/pull/1543/files#diff-8f63f33d62c6c58b08f8ab06d0171c596d83d352ab6619e3b140831b779f9e65R132-R133

Copy link
Contributor

@lsabor lsabor 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.
I left a comment on prediction_status_message that should be looked at, but not blocking.
The other thing is optional addition of tests for conditional question unresolve. (If you don't want to do it, I can add those tests in a later PR).

@hlbmtc hlbmtc merged commit 2101914 into main Dec 3, 2024
1 check passed
@hlbmtc hlbmtc deleted the fix/1008-conditional-closure branch December 3, 2024 10:02
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.

Conditional where child resolved before parent isn't closed

4 participants