-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add quiz migration #7123
Add quiz migration #7123
Conversation
WordPress Dependencies ReportThe No changes detected in the current commit. But the comment was left so it is possible to check for the edit history. This comment was automatically generated by the |
Codecov Report
@@ Coverage Diff @@
## trunk #7123 +/- ##
============================================
+ Coverage 49.47% 49.60% +0.12%
- Complexity 10569 10609 +40
============================================
Files 578 580 +2
Lines 44602 44791 +189
Branches 402 402
============================================
+ Hits 22069 22220 +151
- Misses 22206 22244 +38
Partials 327 327
... and 10 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @m1r0!
Looks working. I left a few minor comments. None is blocking.
Now we need the verification tool to be sure everything migrated properly 😅
$this->migration = $migration; | ||
$this->job_name = 'progress_migration'; | ||
$this->name = strtolower( | ||
( new ReflectionClass( $migration ) )->getShortName() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to replace this reflection with a public method in a migration.
- Reflection is more expensive. But in our case it isn't so important.
- That's an "implicit interface". Trying to find an analogy, I though up a terrible parallel that I don't want to share 😅 Anyway, I prefer explicit over implicit.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes perfect sense. Fixed in e7332eb.
* | ||
* @return string | ||
*/ | ||
public function target_version(): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially, I though we'll use these migrations as part of the installation/update process.
But we decided it is important to do them manually.
Do we still need this method then? Maybe we can remove them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, it's not needed so I've removed it in a993d34.
); | ||
|
||
if ( $this->dry_run ) { | ||
echo esc_html( $comments_query . "\n" ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it supposed to be run in console or only in web?
esc_html
is not a good escaping function for console :)
And for the web the line ending isn't suitable :)
However, we can consider that as a tradeoff.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, you're right. I've made it consistent with the other migration but we should revisit this once we have a CLI command that actually uses the dry run feature. At this stage, we can consider it as a placeholder. 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Resolves #5438
Proposed Changes
Testing Instructions
add_filter( 'sensei_feature_flag_tables_based_progress', '__return_true' );
.Migrate comment-based progress
.sensei_migrated_quiz_last_comment_id
option.Pre-Merge Checklist