Availability Query

A Complete Method Chain for Outdoor-Ad Spot Selection: Anti-Existence Scheduling Predicates, Grouped Quotas, and Two-Phase Greedy Selection

1528 words · ~8 min read
0 views

This is a retrieval-method note, scoped to selecting outdoor-advertising spots against a delivery date range. Method names and step numbers correspond to a working implementation; organization, customer, and deployment details are omitted. The subject is query semantics and execution strategy, not pricing, contracts, or scheduling rules.

The conclusion first: generic paginated queries cannot express the semantics of spot selection; what is needed is a method chain of predicates, grouping, and packet-level strategy. Three judgments up front: 1) availability is an anti-existence judgment over intervals, not a status-field filter, and it can be done entirely in database predicates without precomputing occupancy tables; 2) a group quota of 1 and a quota of N are two different execution paths, switched because window functions are incompatible with ORM tenant filters; 3) excluding spot packets must propagate at group granularity, since per-spot exclusion leaves the business gap of selling twice in the same elevator or unit.