Task: Relocate random-pick generator logic out of currency Qt UI

Table of Contents

This page documents a task in the Commission: currency story. It captures the goal, current status, acceptance, and any notes or results.

Goal

Move the inline random-pick selection logic out of CurrencyDetailDialog::onGenerateClicked() and CurrencyMdiWindow::generateSynthetic() into the generator/service layer, so the Qt UI only orchestrates a call rather than embedding std::uniform_int_distribution selection logic. Step 1 of the regenerate plan (task 6E0CD16E) — must land before the Qt sync task touches these two files.

Status

Field Value
State DONE
Parent story Commission: currency
Now Nothing.
Waiting on Nothing.
Next Nothing.
Last touched 2026-07-06

Acceptance

  • The random-pick selection logic no longer lives in CurrencyDetailDialog or CurrencyMdiWindow; it's callable from the generator/service layer.
  • Both call sites are reduced to orchestration (invoke the relocated call), behaviour unchanged from the user's perspective.
  • Build passes.

Plan

Added ores::refdata::generators::generate_random_fictional_currency() next to the existing generate_fictional_currencies(), moving the std::uniform_int_distribution random-pick there. Updated CurrencyDetailDialog::onGenerateClicked() to call it directly, dropping the now-unused <random> include. CurrencyMdiWindow::generateSynthetic() already only orchestrated (it generates a batch via count, no random pick), so it needed no change.

Notes

PRs

PR Title
#1441 [refdata,qt,build] Relocate currency generator logic; fix CI cache waste

Review

# Comment summary File Decision Notes
1 No unit test for generate_random_fictional_currency() (raised by all 3 review passes) generators_currency_generator_tests.cpp Fixed Added generate_random_fictional_currency_returns_known_currency, d171a7f7b
2 Materializes full 50-entry vector to pick one element (perf nit) currency_generator.cpp Declined Unchanged from original inline code, not a regression; follow-up if ever needed
3 Task doc "Last touched" date one day ahead of PR creation (nit) task_relocate-currency-qt-generator-logic.org Declined Correct for actual last-edit time, not a typo

Result

Added ores::refdata::generators::generate_random_fictional_currency() next to the existing generate_fictional_currencies(), moving the std::uniform_int_distribution random-pick selection out of the Qt UI layer. CurrencyDetailDialog::onGenerateClicked() now calls it directly and is reduced to orchestration; the now-unused <random> include was dropped. CurrencyMdiWindow::generateSynthetic() already only orchestrated a batch generation by count (no random pick embedded), so it needed no change. Acceptance met: no random-pick logic remains in either Qt class, both call sites are pure orchestration, and the build passes. PR #1441.

Emacs 29.3 (Org mode 9.6.15)