Skip to content

Conversation

RaymondLuong3
Copy link
Collaborator

@RaymondLuong3 RaymondLuong3 commented Sep 9, 2025

Adding a draft to a book that is empty fails to create the missing chapters. We needed a way to detect how many chapters exist in the generated draft and notify the front end so that it can create the missing chapters and update the project texts property. This PR creates a new endpoint that can be used to get the chapters that have drafts.


This change is Reviewable

@RaymondLuong3 RaymondLuong3 added the will require testing PR should not be merged until testers confirm testing is complete label Sep 9, 2025
Copy link

codecov bot commented Sep 9, 2025

Codecov Report

❌ Patch coverage is 91.22807% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.08%. Comparing base (7e21ce4) to head (8f77130).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...slate/draft-generation/draft-generation.service.ts 0.00% 3 Missing ⚠️
...draft-apply-dialog/draft-apply-dialog.component.ts 90.90% 0 Missing and 1 partial ⚠️
src/SIL.XForge.Scripture/Models/TextDocument.cs 75.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3432      +/-   ##
==========================================
- Coverage   82.08%   82.08%   -0.01%     
==========================================
  Files         611      611              
  Lines       36314    36355      +41     
  Branches     5966     5968       +2     
==========================================
+ Hits        29810    29843      +33     
- Misses       5641     5645       +4     
- Partials      863      867       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +1178 to +1183
SFProject project = await EnsureProjectPermissionAsync(
curUserId,
sfProjectId,
isServalAdmin: false,
cancellationToken
);

Check warning

Code scanning / CodeQL

Useless assignment to local variable Warning

This assignment to
project
is useless, since its value is never read.

Copilot Autofix

AI 16 days ago

To fix the issue, remove the useless assignment to the local variable project while retaining the awaited call to EnsureProjectPermissionAsync. This means changing the line from SFProject project = await EnsureProjectPermissionAsync(...); to simply await EnsureProjectPermissionAsync(...);. No other code in the vicinity needs to change, and no new methods or imports are required for this fix. The edit occurs only within the scope of the method GetPretranslationChapterCountAsync in file src/SIL.XForge.Scripture/Services/MachineApiService.cs, replacing lines 1178 through 1183.


Suggested changeset 1
src/SIL.XForge.Scripture/Services/MachineApiService.cs

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/SIL.XForge.Scripture/Services/MachineApiService.cs b/src/SIL.XForge.Scripture/Services/MachineApiService.cs
--- a/src/SIL.XForge.Scripture/Services/MachineApiService.cs
+++ b/src/SIL.XForge.Scripture/Services/MachineApiService.cs
@@ -1175,7 +1175,7 @@
     )
     {
         // Ensure that the user has permission
-        SFProject project = await EnsureProjectPermissionAsync(
+        await EnsureProjectPermissionAsync(
             curUserId,
             sfProjectId,
             isServalAdmin: false,
EOF
@@ -1175,7 +1175,7 @@
)
{
// Ensure that the user has permission
SFProject project = await EnsureProjectPermissionAsync(
await EnsureProjectPermissionAsync(
curUserId,
sfProjectId,
isServalAdmin: false,
Copilot is powered by AI and may make mistakes. Always verify output.
@RaymondLuong3 RaymondLuong3 force-pushed the fix/sf-3554-add-to-project branch from e25084e to 8f77130 Compare September 15, 2025 19:21
@RaymondLuong3 RaymondLuong3 marked this pull request as draft September 15, 2025 20:35
@RaymondLuong3
Copy link
Collaborator Author

I am converting this to a draft while we move towards getting draft apply working on the backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
will require testing PR should not be merged until testers confirm testing is complete
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant