-
-
Notifications
You must be signed in to change notification settings - Fork 5
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
SF-3193 Fix additional training data option not visible #2994
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2994 +/- ##
==========================================
+ Coverage 82.33% 82.38% +0.04%
==========================================
Files 543 543
Lines 31663 31663
Branches 5147 5125 -22
==========================================
+ Hits 26069 26084 +15
+ Misses 4840 4823 -17
- Partials 754 756 +2 ☔ View 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.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @RaymondLuong3)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 229 at r1 (raw file):
filterNullish(), map(async projectDoc => { this.projectChanged = true;
Why can't we use a utility like distinctUntilChanged
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.
Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @Nateowami)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 229 at r1 (raw file):
Previously, Nateowami wrote…
Why can't we use a utility like
distinctUntilChanged
I'm not sure how that would help in this situation. The trainingDataQuery will emit based on any updates to the query. We just have to be sure that we don't reset the initial training data files unless the user changes projects. (This might never happen since the user would have to paste a URL into the browser.)
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.
Reviewable status: 0 of 2 files reviewed, 2 unresolved discussions (waiting on @marksvc, @Nateowami, and @RaymondLuong3)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 228 at r1 (raw file):
takeUntilDestroyed(this.destroyRef), filterNullish(), map(async projectDoc => {
Would switchMap
be more appropriate here?
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.
Reviewable status: 0 of 2 files reviewed, 3 unresolved discussions (waiting on @marksvc, @Nateowami, and @RaymondLuong3)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 253 at r1 (raw file):
if (this.projectChanged) { // Set the selection based on previous builds this.projectChanged = false;
This took me a minute to understand. Maybe renaming the flag to something like isTrainingDataInitialized
or isProjectTrainingDataInitialized
(and inverting it) would read better?
if (!this.isTrainingDataInitialized) {
this.isTrainingDataInitialized = true;
// Set the selection based on previous builds
this.setInitialTrainingDataFiles(this.availableTrainingFiles.map(d => d.dataId));
}
Code quote:
this.projectChanged = false;
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.
Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: all files reviewed, 5 unresolved discussions (waiting on @Nateowami, @RaymondLuong3, and @siltomato)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 253 at r1 (raw file):
Previously, siltomato wrote…
This took me a minute to understand. Maybe renaming the flag to something like
isTrainingDataInitialized
orisProjectTrainingDataInitialized
(and inverting it) would read better?if (!this.isTrainingDataInitialized) { this.isTrainingDataInitialized = true; // Set the selection based on previous builds this.setInitialTrainingDataFiles(this.availableTrainingFiles.map(d => d.dataId)); }
Yeah, perhaps
isProjectTrainingDataInitialized
or
isInitialTrainingDataSetForProject
.
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 245 at r1 (raw file):
}) ) .subscribe(() => {
❓ I don't understand why it's okay now but wasn't before, since we are still using .subscribe(
and takeUndilDestroyed(this.destroyRef)
. Was the this.trainingDataSub...subscribe(
not calling something that was needed/adequate but the this.activatedProjectprojectDoc$...map(...().subscribe(
is calling what is needed/adequate??
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 247 at r1 (raw file):
.subscribe(() => { this.availableTrainingFiles = []; if (this.activatedProject.projectDoc?.data?.translateConfig.draftConfig.additionalTrainingData) {
❓ Why the change to use this.activatedProject
? Is there a reason we want to be sure we are operating on the activatedProject rather than the next projectDoc
coming down the line from this.activatedProject.projectDoc$
? It seems like there could in principle be a mismatch between the local projectDoc
and the this.activatedProject.projectDoc
.
3398d37
to
b63086b
Compare
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.
Reviewable status: 1 of 2 files reviewed, 3 unresolved discussions (waiting on @marksvc and @siltomato)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 228 at r1 (raw file):
Previously, siltomato wrote…
Would
switchMap
be more appropriate here?
Thanks, that should be the right way to go
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 245 at r1 (raw file):
Previously, marksvc wrote…
❓ I don't understand why it's okay now but wasn't before, since we are still using
.subscribe(
andtakeUndilDestroyed(this.destroyRef)
. Was thethis.trainingDataSub...subscribe(
not calling something that was needed/adequate but thethis.activatedProjectprojectDoc$...map(...().subscribe(
is calling what is needed/adequate??
The issue was that before there were two different observables, and the subscription to the merge(this.trainingDataQuery.localChanges$, ...)
was active, but the observable for the projectDoc$
was not subscribed to. Since it was not subscribed, all the logic is never run. So in this change, I updated it to only be 1 observable to be subscribed to.
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 247 at r1 (raw file):
Previously, marksvc wrote…
❓ Why the change to use
this.activatedProject
? Is there a reason we want to be sure we are operating on the activatedProject rather than the nextprojectDoc
coming down the line fromthis.activatedProject.projectDoc$
? It seems like there could in principle be a mismatch between the localprojectDoc
and thethis.activatedProject.projectDoc
.
There will not be a mismatch since we can have confidence that the projectId
and the projectDoc
will be for the same project. The main reasoning for the change is because we are doing a switchMap
transformation of the observable, and preserving the projectDoc
just for the id
was not necessary
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 253 at r1 (raw file):
Previously, marksvc wrote…
Yeah, perhaps
isProjectTrainingDataInitialized
or
isInitialTrainingDataSetForProject
.
Done.
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @marksvc)
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.
Reviewed 1 of 2 files at r1.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @marksvc)
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.
Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @RaymondLuong3)
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 245 at r1 (raw file):
Previously, RaymondLuong3 (Raymond Luong) wrote…
The issue was that before there were two different observables, and the subscription to the
merge(this.trainingDataQuery.localChanges$, ...)
was active, but the observable for theprojectDoc$
was not subscribed to. Since it was not subscribed, all the logic is never run. So in this change, I updated it to only be 1 observable to be subscribed to.
Wow. Thank you.
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-generation-steps/draft-generation-steps.component.ts
line 247 at r1 (raw file):
Previously, RaymondLuong3 (Raymond Luong) wrote…
There will not be a mismatch since we can have confidence that the
projectId
and theprojectDoc
will be for the same project. The main reasoning for the change is because we are doing aswitchMap
transformation of the observable, and preserving theprojectDoc
just for theid
was not necessary
Right, there is no local projectDoc
. Thank you.
b63086b
to
c3ac2d4
Compare
After the draft generation steps component was converted to not subclass the subscription disposable class, the
subscribe
method needed to be explicitly called in order for the logic to enable additional training data to be run. I have also added a test which will catch future regressions showing the additional training data option.This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)