-
-
Notifications
You must be signed in to change notification settings - Fork 5
SF-3663 Mark training file as deleted, instead of deleting #3615
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
base: master
Are you sure you want to change the base?
Conversation
0be0ab7 to
f4b9f22
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3615 +/- ##
==========================================
- Coverage 82.82% 82.75% -0.07%
==========================================
Files 610 610
Lines 37400 37441 +41
Branches 6151 6154 +3
==========================================
+ Hits 30976 30985 +9
- Misses 5478 5518 +40
+ Partials 946 938 -8 ☔ View full report in Codecov by Sentry. |
This fixes a bug where deleted training files couldn't be found in the project, since their file name would be missing and the app wouldn't register that there was a training file associated with a build entry.
f4b9f22 to
58bdba2
Compare
RaymondLuong3
left a comment
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.
This looks like it is compatible with older clients, which is a good thing. A few comments to address and additional tests are needed.
@RaymondLuong3 reviewed 18 files and all commit messages, and made 8 comments.
Reviewable status: all files reviewed, 7 unresolved discussions (waiting on @josephmyers).
src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/confirm-sources/confirm-sources.component.ts line 64 at r1 (raw file):
(this.trainingDataQuery?.docs .map(doc => doc.data) .filter(d => d != null && !d.deleted) as TrainingData[]) ?? [];
When deleted is optional, this needs to consider filter the case when deleted != true
Code quote:
filter(d => d != null && !d.deleted) as TrainingData[]) ?? [];src/RealtimeServer/scriptureforge/models/training-data.ts line 16 at r1 (raw file):
skipRows: number; title: string; deleted: boolean;
This should be optional, otherwise you will have to migrate all training data records in the db
Code quote:
deleted: boolean;src/SIL.XForge.Scripture/Controllers/SFProjectsRpcController.cs line 710 at r1 (raw file):
} public async Task<IRpcMethodResult> MarkTrainingDataDeleted(string projectId, string dataId)
It should be straight forward to fill in the missing tests for this controller.
Code quote:
public async Task<IRpcMethodResult> MarkTrainingDataDeleted(string projectId, string dataId)src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-sources/draft-sources.component.ts line 188 at r1 (raw file):
this.savedTrainingFiles = this.trainingDataQuery?.docs.filter(d => d.data != null && !d.data.deleted).map(d => d.data!) ?? [];
Filter only the case where deleted != true`
Code quote:
(d => d.data != null && !d.data.deletedtest/SIL.XForge.Scripture.Tests/Services/TrainingDataServiceTests.cs line 505 at r1 (raw file):
[Test] public async Task MarkFileDeleted_SetsDeletedFlag()
You will want to add tests for when the file is not found. I can see that happening.
Code quote:
public async Task MarkFileDeleted_SetsDeletedFlag()test/SIL.XForge.Scripture.Tests/Services/TrainingDataServiceTests.cs line 507 at r1 (raw file):
public async Task MarkFileDeleted_SetsDeletedFlag() { var env = new TestEnvironment();
I would also assert that training data is not deleted before calling MarkFileDeleted
Code quote:
var env = new TestEnvironment();src/SIL.XForge.Scripture/ClientApp/src/app/translate/draft-generation/draft-history-list/draft-history-list.component.spec.ts line 37 at r1 (raw file):
provideTestRealtime(SF_TYPE_REGISTRY), provideHttpClient(withFetch()), provideHttpClientTesting(),
Are these changes necessary?
Code quote:
provideHttpClient(withFetch()),
provideHttpClientTesting(),
This fixes a bug where deleted training files couldn't be found in the project, since their file name would be missing and the app wouldn't register that there was a training file associated with a build entry.
This change is