Adding fit note at manual fit creation

This commit is contained in:
Ian Roddis committed 2026-07-31 09:02:24 -03:00
1 parent 23d07505bd
commit 30a13644ce
3 files changed
+82 -1

No files matched your search

@@ -52,6 +52,9 @@
<option value="none">None</option>
</select>
</label>
<label>Note (optional)
<input type="text" name="note" placeholder="Add a note…">
</label>
<button type="submit" class="btn btn-primary">Add fit</button>
</form>
{% endif %}
+4
View File
@@ -2271,6 +2271,7 @@ async def create_augmented_part_fit(
other_augmented_part_id: str = Form(""),
other_attachment_point_id: str = Form(""),
label: FitLabel = Form(FitLabel.EXACT),
note: str = Form(""),
db: AsyncSession = Depends(get_db),
actor: User = Depends(web_require("fits:write")),
):
@@ -2335,6 +2336,9 @@ async def create_augmented_part_fit(
"Fit", fit.id, f"attachment points {ap_a.id}↔{ap_b.id} ({label.value})"
),
)
if note.strip():
await fit_note_crud.create(db, fit=fit, author=actor, body=note.strip())
await db.refresh(fit, attribute_names=["notes"])
ctx = await _augmented_part_fits_ctx(
db, augmented_part_id, can_write=_can_write_fits(actor), error=error
)