«Predefinito» nella finestra Aggiungi asta; tolti Tema scuro e Menu compresso dalle Impostazioni (#48)
La finestra «Aggiungi asta» mandava sempre un modo (Osserva per primo), e il server lo usava prima di tutto il resto: un'aggiunta a mano ignorava sia il modo scritto sulla scheda del prodotto sia «Modo delle aste aggiunte a mano», che pure il suo suggerimento prometteva. Ora la prima scelta, proposta, è «Predefinito» e manda mode null: il server applica il modo della scheda e, se manca, l'impostazione (l'ordine in ProductRules.Resolve era già giusto, ora è commentato e provato da un test puro e da uno sul monitor contro il simulatore). Il suggerimento di «Predefinito» dice quale modo vale adesso, perché il messaggio mode porta il valore dell'impostazione (newAuctionMode). Il catalogo continua a mandare il suo modo. I suggerimenti della colonna Stato dei Prodotti dicono che quel modo vale anche per le aste aggiunte con il + in Predefinito. «Tema scuro» valeva solo per il browser da cui si salvava, «Menu compresso» arrivava al browser ma nessuno lo leggeva: si tolgono da AppSettings, dal messaggio mode e dalla pagina Impostazioni (la sezione diventa «Registri»). Tema e menu restano ai loro bottoni, ricordati da ogni browser. Una riga delle impostazioni che contiene ancora le due chiavi si legge lo stesso (chiavi sconosciute ignorate): lo provano un test puro su SettingsStore.Parse e uno su PostgreSQL. Lo scostamento dalla specifica §15 è annotato in fondo all'ADR 0016; guida aggiornata in Aste, Impostazioni, Cerca e prodotti e Primo avvio. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 68ab6fdee7f38eb57584c4c60476e74034198fe9)
This commit is contained in:
1 parent
213b18add9
commit
a39da80e32
17 files changed
+182
-31
No files matched your search
@@ -277,4 +277,61 @@ public class ApplyProductLimitsTests
|
||||
Assert.Equal(7, b.MaxPrice); // l'altra resta com'era
|
||||
Assert.False(monitor.ReturnToProductLimits("nessuna").Ok);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Aggiunta_a_mano_con_Predefinito_prende_il_modo_della_scheda_e_poi_quello_delle_impostazioni()
|
||||
{
|
||||
var world = new SimWorld(seed: 33, populate: false);
|
||||
var settings = new AppSettings { QuietHoursEnabled = false, DefaultNewAuctionState = "Ferma", AutoAddNewAuctionState = "Attiva" };
|
||||
var one = world.AddRunningAuction(seconds: 600);
|
||||
var two = world.AddRunningAuction(seconds: 600);
|
||||
var three = world.AddRunningAuction(seconds: 600);
|
||||
|
||||
await using var sim = await SimulatedBidoo.StartAsync(world);
|
||||
var refs = sim.References();
|
||||
using var transport = new BidooTransport(() => refs, 0);
|
||||
using var lane = new BidLane(transport, () => refs, keepWarm: false);
|
||||
var api = new BidooApi(transport, lane, () => refs) { Username = world.MyUsername };
|
||||
var docs = new MemoryDocumentStore();
|
||||
var log = new AppLog(null);
|
||||
var account = new AccountState();
|
||||
account.SetUser(world.MyUsername, world.MyUserId);
|
||||
var risk = new RiskManager(docs, new ListLedger());
|
||||
var learning = new LearningService(docs, new MemoryLearningData(), () => settings, log);
|
||||
var products = new ProductStore(null);
|
||||
await using var monitor = new AuctionMonitor(new MonitorDeps
|
||||
{
|
||||
Settings = () => settings,
|
||||
References = () => refs,
|
||||
Api = api,
|
||||
Clock = new ServerClock(),
|
||||
Strategy = new BidStrategy(risk, learning, products, () => account.Balance),
|
||||
Risk = risk,
|
||||
Learning = learning,
|
||||
Latency = new LatencyModel(docs),
|
||||
Recorder = new AuctionRecorder(null, null, () => settings, () => world.MyUsername, Worlds.Simulator),
|
||||
Products = products,
|
||||
Account = account,
|
||||
Log = log,
|
||||
Documents = docs,
|
||||
World = Worlds.Simulator,
|
||||
Limits = new ProductLimits(products, () => settings)
|
||||
});
|
||||
|
||||
// «Predefinito» (mode null) senza modo sulla scheda: «Modo delle aste aggiunte a mano».
|
||||
var (a, message) = await monitor.AddAsync(new AddAuctionRequest(one.Id), CancellationToken.None);
|
||||
Assert.NotNull(a);
|
||||
Assert.Equal(RunMode.Stopped, a!.Mode);
|
||||
Assert.Contains("Ferma", message);
|
||||
|
||||
// Con il modo scritto sulla scheda vince la scheda.
|
||||
products.Upsert(new ProductRecord { ProductKey = a.ProductKey, DisplayName = a.Name, AutoState = "osserva" });
|
||||
var (b, _) = await monitor.AddAsync(new AddAuctionRequest(two.Id), CancellationToken.None);
|
||||
Assert.Equal(a.ProductKey, b!.ProductKey);
|
||||
Assert.Equal(RunMode.Watch, b.Mode);
|
||||
|
||||
// Un modo scelto nella finestra vince su scheda e impostazioni.
|
||||
var (c, _) = await monitor.AddAsync(new AddAuctionRequest(three.Id, Mode: RunMode.Active), CancellationToken.None);
|
||||
Assert.Equal(RunMode.Active, c!.Mode);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user