
t1-01-repair-priority-selection
T1
Prompt
You are fixing a bug in a small C# file. Below is the full contents of `RepairPriority.cs`, followed by the bug report. Reply with ONLY the complete corrected contents of `RepairPriority.cs` in a single C# code block - no explanation before or after the code block. ## Current file: RepairPriority.cs ```csharp namespace RepairPriorityKata; public sealed class Drone { public required string Id { get; init; } public double Energy { get; init; } public double MaxEnergy { get; init; } } public static class FleetDispatcher { /// <summary> /// Returns the drone that most urgently needs repair: the one with the LOWEST energy /// percentage (Energy / MaxEnergy), not the lowest absolute energy. A small drone at 10% of /// a 50-capacity tank is more urgent than a large drone at 40% of a 500-capacity tank, even /// though the large drone has more energy in absolute terms. /// </summary> public static Drone SelectNextDroneForRepair(IReadOnlyList<Drone> drones) { if (drones.Count == 0) { throw new ArgumentException("Fleet has no drones to select from.", nameof(drones)); } var mostUrgent = drones[0]; foreach (var drone in drones) { if (drone.Energy < mostUrgent.Energy) { mostUrgent = drone; } } return mostUrgent; } } ``` ## Bug report The method's own doc comment says it should pick the drone with the lowest energy **percentage** (`Energy / MaxEnergy`), but the implementation compares absolute `Energy` values instead. Fleet ops report the dispatcher keeps sending repair crews to large drones that still have plenty of charge left in percentage terms, while small, nearly-drained drones wait. ## Your task Fix `SelectNextDroneForRepair` so it compares energy percentage, not absolute energy, matching the doc comment. Do not change the method signature or the `Drone` class. Make the smallest change that fixes the bug. Reply with ONLY the corrected `RepairPriority.cs` file in one C# code block.