FEAT:🌙 Prefer remote stands overnight for configured airfields#1814
FEAT:🌙 Prefer remote stands overnight for configured airfields#1814MrAdder wants to merge 18 commits intoVATSIM-UK:mainfrom
Conversation
full push of feature
- Fixed the root cause of the failing night-weighting test by correcting the airfield lookup in nightTimeRemoteStandOrderCondition(): it now uses planned_destairport (which is populated on NetworkAircraft) instead of arrival_airfield (which was not), so the night remote weighting can actually activate. - Made the airfield match case-insensitive by normalizing both the aircraft destination and configured airfield list to uppercase before comparison, preventing config/case mismatches from disabling the feature.
|
Would it not be better to define a new property for stands indicating whether they are remote/preferred for overnight parking? Hijacking the assignment priority for this purpose seems a little perverse when it is also used (as I understand it) for marking stands as temporarily out-of-use, or for larger stands in mixed-size stand arrangements |
I can implement that logic instead I just did it this way originally as it seemed logical with what was asked didn't think of this way round |
|
Updated PR Text in regards to changes |
database/migrations/2026_02_25_000001_add_overnight_remote_preferred_to_stands.php
Outdated
Show resolved
Hide resolved
Co-authored-by: Coby Chapman <cobylc.121@gmail.com>
…ferred_to_stands.php Co-authored-by: Coby Chapman <cobylc.121@gmail.com>
Co-authored-by: Coby Chapman <cobylc.121@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds an “overnight remote preference” signal to stands and introduces a night-time ordering bias intended to prefer those stands during a configured window.
Changes:
- Adds
stands.overnight_remote_preferredcolumn, model cast/fillable, factory default, and Filament UI toggle/column. - Adds a night-window ORDER BY fragment to prefer
overnight_remote_preferredstands. - Adds functional tests covering “night prefers flagged stand” vs “daytime unchanged”.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
app/Allocator/Stand/SelectsStandsUsingStandardConditions.php |
Introduces night-window ORDER BY bias preferring overnight_remote_preferred. |
config/stands.php |
Adds night window configuration keys. |
database/migrations/2026_02_25_000001_add_overnight_remote_preferred_to_stands.php |
Adds new boolean column + index. |
app/Models/Stand/Stand.php |
Adds fillable + boolean cast for new column. |
database/factories/Stand/StandFactory.php |
Sets factory default for new column. |
app/Filament/Resources/StandResource.php |
Adds toggle to form and boolean column to table. |
lang/en/stands/form.php |
Adds form label/helper copy for new toggle. |
lang/en/stands/table.php |
Adds table column label. |
tests/app/Allocator/Stand/FallbackArrivalStandAllocatorTest.php |
Adds tests for night/day ordering behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…dOrderCondition()
There was a problem hiding this comment.
Pull request overview
Adds an opt-in “overnight remote stand” preference to arrival stand allocation, allowing configured airfields to bias allocations during a Europe/London night window toward stands explicitly flagged as overnight-remote.
Changes:
- Introduces
stands.overnight_remote_preferred(DB column + model cast/fillable + factory default) and exposes it in Filament. - Adds a conditional ORDER BY fragment to prefer
overnight_remote_preferredstands during a configured night window for configured destination airfields. - Adds functional tests for in-window vs out-of-window allocation behavior.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/app/Allocator/Stand/FallbackArrivalStandAllocatorTest.php | Adds tests covering overnight preference and non-preference outside the night window. |
| app/Allocator/Stand/SelectsStandsUsingStandardConditions.php | Prepends an optional night-window ORDER BY fragment for overnight_remote_preferred. |
| database/migrations/2026_02_25_000001_add_overnight_remote_preferred_to_stands.php | Adds the new boolean column + index to stands. |
| app/Models/Stand/Stand.php | Makes the new field mass-assignable and casts it to boolean. |
| database/factories/Stand/StandFactory.php | Sets default overnight_remote_preferred to false. |
| app/Filament/Resources/StandResource.php | Adds toggle + table column for the new flag in the admin UI. |
| config/stands.php | Adds configuration for night-window weighting. |
| lang/en/stands/form.php | Adds label/helper text for the new toggle. |
| lang/en/stands/table.php | Adds table column label for the new flag. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
|



✨ Summary
This PR adds an optional overnight bias to stand allocation for selected arrival airfields.
When enabled, and during a configured night window (Europe/London), the allocator will prefer stands explicitly marked as overnight-remote via a new
stands.overnight_remote_preferredflag.✅ Default behaviour remains unchanged because the feature is disabled by default.
🔧 What changed
🛬 Allocation ordering update
nightTimeRemoteStandOrderCondition()to:planned_destairport(normalised to uppercase) for airfield matchingstands.night_remote_stand_weighting.enabled+airfieldsstart_hour→end_hour, supports midnight crossing)stands.overnight_remote_preferred = 1Ordering fragment added (prepended when active):
🧱 Schema change (new column)
stands.overnight_remote_preferredboolean column:false2026_02_25_000001_add_overnight_remote_preferred_to_stands.php🧩 Model / factory updates
Standmodel:overnight_remote_preferredto$fillableStandFactorydefault:overnight_remote_preferred => false🖥️ Admin UI (Filament) updates
StandResourceform:overnight_remote_preferredStandResourcetable:overnight_remote_preferred🌍 Config updates
stands.night_remote_stand_weightingfeature flag + time window configremote_priority_threshold(no longer used)Config still includes:
enabled(env:NIGHT_REMOTE_STAND_WEIGHTING_ENABLED, default false)airfieldsstart_hourend_hour🧪 Tests
Adds/updates functional coverage to verify:
overnight_remote_preferred=trueis preferredTests use
Carbon::setTestNow()and reset afterwards.💡 Why
Some airfields prefer remote stands overnight (ops flow, noise/terminal constraints, overnight parking patterns).
This change makes that preference explicit and configurable per stand, rather than inferring “remote-ness” from
assignment_priority.🚀 Rollout / Ops notes
✅ Enable feature (optional)
✅ Mark stands to be preferred overnight
overnight_remote_preferred = truefor relevant stands (via Filament UI or DB update)✅ Limit scope per airfield
stands.night_remote_stand_weighting.airfields🟢 Low risk
🧠 Considerations
Europe/Londontimezone (DST-aware)overnight_remote_preferred📋 Checklist
Fixes #1762