fix: keep automatic cultivation on one stable primary per species

This commit is contained in:
AttilaNet
2026-11-13 08:51:03 +08:00
parent 01ad2e3ab9
commit 4fbe895999
35 changed files with 2069 additions and 322 deletions
+7 -3
View File
@@ -82,6 +82,7 @@ import ranch_web.policies,ranch_web.views,ranch_web.actions
fields = [field for page in value["pages"] for field in page["form"]]
self.assertTrue(all(field["label"] and isinstance(field["path"], list) for field in fields))
self.assertNotIn(["policy", "feed_target"], [field["path"] for field in fields])
self.assertNotIn(["policy", "keep_better_quality"], [field["path"] for field in fields])
self.assertNotIn(["progression_policy", "battle_mode"], [field["path"] for field in fields])
self.assertEqual(dict(PAGES)["statistics"], "数据分析")
self.assertEqual(dict(PAGES)["plans"], "执行计划")
@@ -114,16 +115,19 @@ import ranch_web.policies,ranch_web.views,ranch_web.actions
if code == 5:
self.assertTrue(row["edits"]["enabled"]["disabled"])
def test_egg_keep_count_and_missing_stock_rule_bind_real_config(self):
def test_fixed_retention_display_preserves_legacy_count_and_missing_stock_rule(self):
config = deepcopy(self.worker.config)
config["policy"]["egg_rules"]["1001010"] = {"enabled": True, "keep_count": 5, "priority": 1, "market_id": "sc_city1"}
self.worker.save_config(config)
dto = self.view("bag", {"category": "eggs"})
row = next(row for row in dto["rows"] if row["id"] == "1001010")
column = next(column for column in dto["columns"] if column["key"] == "keep_count")
column = next(column for column in dto["columns"] if column["key"] == "retention_text")
self.assertEqual(column["label"], "牧场保留")
self.assertEqual(row["keep_count"], 5)
self.assertEqual(column["edit"]["path"], ["policy", "egg_rules", "{id}", "keep_count"])
self.assertEqual(row["retention_text"], "主培养1 + 更优备选≤1")
self.assertNotIn("edit", column)
self.assertNotIn("keep_count", [column["key"] for column in dto["columns"]])
self.assertEqual(self.worker.config["policy"]["egg_rules"]["1001010"]["keep_count"], 5)
self.assertTrue(row["edits"]["market_id"]["options"])
def test_add_rule_species_defaults_follow_current_market_and_desktop_fallback(self):