Problem/Motivation

Found by the release audit of 1.x at e9bcd460, with a method-body clone detector run over the whole module (tests included) and a second pass grouping entity queries by their conditions.

  • An allotment's release lead is put into words six times: "Held until taken" or "an interval before the slot", in ResourceAllotmentListBuilder and PresetAllotmentListBuilder (byte-identical methods), SlotAllotmentsController, ResourceAllotmentsController, PresetTariffsController (which says "before each slot") and ApplyTariffPresetForm.
  • The grades a tariff prices are read twice: VenueAvailabilityBound::getGradeIds() and PlaceTariffMatcher::getGradeIds().
  • Grant purges are written for each kind of grant: deleting lapsed grants on cron, and the grants naming a row being deleted, in ManagerHooks and again in OperatorHooks.
  • The optional guarantee amount is built, checked and stored twice, in CaptureGuaranteeAction and ReleaseGuaranteeAction.
  • Opening a signed link to its order is written twice: TicketController::getOrderForToken() and CancelController::getOrderForToken().
  • A venue's sections as options are written twice: VenuePlaceFilterForm::getSectionOptions() repeats VenuePlaceOptionsTrait::getSectionOptions(), and the filter form asks it twice per build.
  • Three method names in the docs no longer exist: heldQuantities() in cart.md is getHeldQuantities(), messageSettingValue() in booker-messages.md is getMessageSettingValue(), BookingWorkflowStarter::onHeld() in resource-type-design.md is start().
  • The resource type page still reads as a plan. It says types and tenants have no admin forms yet (both have them), keeps an open decision between a config and a content entity (a config entity shipped), and lists migration and phasing steps for work that has shipped.
  • "Delete the records naming these" is written in seven places: the child cascades of BookingResource, BookingSlot, BookingResourceTariff and BookingTariffPreset, the order's bookings in BookingHooks::yoyakuTransactionPredelete(), and the grant purges of D3.
  • The refusal "still has records (type: n, type: n)" is built three times: ReferencingRecords::refuseDeletionWhileNamed(), BookingResource::preDelete() and Tenant::preDelete().
  • Ten entity getters re-implement EntityIntegerValueTrait::getIntegerValue(): the order's hold times, the slot's start, end and opening, the allotments' release, the order's archive time and the place's position.
  • The booking operations are mapped to the booking manager three times: BookingsForm::getCoreActions(), BookingOverviewForm and BookingOperationController::run().
  • An order's bookings are queried by hand beside TransactionLookup::getBookings(), in LocalBookingClient::buildOrderArray() and BookingHooks::yoyakuTransactionPredelete().

Proposed resolution

Give each computation one owner and call it from every place, correct the three names, and rewrite the resource type page as a description of what exists. Regenerate docs/metrics.md last.

Remaining tasks

Write the merge request.

User interface changes

Every allotment screen says the release lead as "@interval before each slot". The resource and preset allotment lists said "before the slot".

API changes

BookingManagerInterface gains applyOperation(), which matches a booking operation name to its method. PlaceTariffMatcher::getGradeIds() is static. PlacementPartitions and VenuePlacementProvider no longer take the tariff matcher, and LocalBookingClient and the ResourceManagers audience take the transaction lookup.

AI-Generated: Yes (Claude Code was used to run this audit and draft this issue. I reviewed it before posting.)

Issue fork yoyaku-3631964

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mably created an issue. See original summary.

mably’s picture

Title: Seven computations are written twice or more, and two doc pages name methods that are gone or a plan that has shipped » Eleven computations are written twice or more, and two doc pages name methods that are gone or a plan that has shipped
Issue summary: View changes

mably’s picture

Issue summary: View changes
Status: Active » Needs review

  • mably committed 586f38b4 on 1.x
    task: #3631964 Eleven computations are written twice or more, and two...
mably’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.