Adding fit type to create fit form

This commit is contained in:
Ian Roddis committed 2026-07-31 08:56:39 -03:00
1 parent b2d01f1ab0
commit 92ca6b2a9f
2 files changed
+10 -2

No files matched your search

@@ -45,6 +45,13 @@
</select> </select>
</label> </label>
<div id="ap-{{ augmented_part_id }}-fit-other-points"></div> <div id="ap-{{ augmented_part_id }}-fit-other-points"></div>
<label>Fit type
<select name="label">
<option value="exact" selected>Exact</option>
<option value="possible">Possible</option>
<option value="none">None</option>
</select>
</label>
<button type="submit" class="btn btn-primary">Add fit</button> <button type="submit" class="btn btn-primary">Add fit</button>
</form> </form>
{% endif %} {% endif %}
+3 -2
View File
@@ -2269,6 +2269,7 @@ async def create_augmented_part_fit(
augmented_part_id: int, augmented_part_id: int,
own_attachment_point_id: int = Form(...), own_attachment_point_id: int = Form(...),
other_attachment_point_id: str = Form(""), other_attachment_point_id: str = Form(""),
label: FitLabel = Form(FitLabel.EXACT),
db: AsyncSession = Depends(get_db), db: AsyncSession = Depends(get_db),
actor: User = Depends(web_require("fits:write")), actor: User = Depends(web_require("fits:write")),
): ):
@@ -2285,7 +2286,7 @@ async def create_augmented_part_fit(
elif await fit_crud.get_by_attachment_points(db, ap_a, ap_b) is not None: elif await fit_crud.get_by_attachment_points(db, ap_a, ap_b) is not None:
error = "That fit already exists." error = "That fit already exists."
else: else:
fit = await fit_crud.create(db, ap_a=ap_a, ap_b=ap_b, label=FitLabel.EXACT) fit = await fit_crud.create(db, ap_a=ap_a, ap_b=ap_b, label=label)
await audit_crud.log( await audit_crud.log(
db, db,
actor=actor, actor=actor,
@@ -2293,7 +2294,7 @@ async def create_augmented_part_fit(
resource_type="Fit", resource_type="Fit",
resource_id=fit.id, resource_id=fit.id,
description=audit_crud.describe_create( description=audit_crud.describe_create(
"Fit", fit.id, f"attachment points {ap_a.id}↔{ap_b.id}" "Fit", fit.id, f"attachment points {ap_a.id}↔{ap_b.id} ({label.value})"
), ),
) )
ctx = await _augmented_part_fits_ctx( ctx = await _augmented_part_fits_ctx(