diff --git a/app.py b/app.py
index 7cdd6af..e02c1e9 100644
--- a/app.py
+++ b/app.py
@@ -29,7 +29,7 @@ from ui_builder import install_ui_builder
from khl_site.khl_data_center import APP as khl_site_app
BASE_DIR = Path(__file__).resolve().parent
-BUILD_VERSION = "2026.09.15.6"
+BUILD_VERSION = "2026.09.15.7"
# compatibility: BUILD_VERSION = "2026.08.26.1"
# compatibility: BUILD_VERSION = "2026.08.25.1"
# compatibility: BUILD_VERSION = "2026.08.24.15"
diff --git a/hockey_data/agent_bridge.py b/hockey_data/agent_bridge.py
index ca89ed1..5ca191e 100644
--- a/hockey_data/agent_bridge.py
+++ b/hockey_data/agent_bridge.py
@@ -210,7 +210,17 @@ def _mapping_rule_command(
matched = _mapping_rule_matches(left_value, operator, right_value)
if action == "text_colour":
- chosen = rule.get("true_value", "#E5CEA8") if matched else rule.get("false_value", "#FFFFFF")
+ branch = "true" if matched else "false"
+ default_colour = "#E5CEA8" if matched else "#FFFFFF"
+ output_mode = str(rule.get(f"{branch}_mode") or "value").strip().lower()
+ if output_mode == "field":
+ output_key = str(rule.get(f"{branch}_key") or "").strip()
+ output_item = by_key.get(output_key)
+ if output_item is None:
+ return None, f"missing_{branch}_colour:{output_key}"
+ chosen = output_item.get("value")
+ else:
+ chosen = rule.get(f"{branch}_value", default_colour)
if chosen is None or str(chosen).strip() == "":
return None, ""
return {
diff --git a/hockey_data/static/admin-directories.css b/hockey_data/static/admin-directories.css
index 1fd35b1..e7fa299 100644
--- a/hockey_data/static/admin-directories.css
+++ b/hockey_data/static/admin-directories.css
@@ -2400,3 +2400,9 @@ body.hockey-admin-settings-open { overflow: hidden; }
}
.hockey-stadiums-table-wrap { max-height: 55dvh; }
}
+
+/* BUILD139: dynamic SQL/data colour outputs for Mapping rules. */
+.hockey-map-rule-colour-values{align-items:start}
+.hockey-map-rule-colour-branch{display:grid;gap:6px;min-width:0;padding:7px;border:1px solid #263b50;border-radius:8px;background:#0b151f}
+.hockey-map-rule-colour-branch label{min-width:0}
+.hockey-map-rule-colour-branch select,.hockey-map-rule-colour-branch input{min-width:0}
diff --git a/hockey_data/static/admin-directories.js b/hockey_data/static/admin-directories.js
index 2203f22..04a38a4 100644
--- a/hockey_data/static/admin-directories.js
+++ b/hockey_data/static/admin-directories.js
@@ -1788,7 +1788,11 @@
right_mode: String(raw.right_mode || "field"),
right_key: String(raw.right_key || ""),
right_value: raw.right_value == null ? "" : String(raw.right_value),
+ true_mode: String(raw.true_mode || "value"),
+ true_key: String(raw.true_key || ""),
true_value: raw.true_value == null ? (actionDefault === "visibility" ? "on" : "#E5CEA8") : String(raw.true_value),
+ false_mode: String(raw.false_mode || "value"),
+ false_key: String(raw.false_key || ""),
false_value: raw.false_value == null ? (actionDefault === "visibility" ? "off" : "#FFFFFF") : String(raw.false_value),
};
}
@@ -1859,7 +1863,10 @@
};
}
if (kind !== "text") return null;
- const colour = matched ? rule.true_value : rule.false_value;
+ const branch = matched ? "true" : "false";
+ const outputMode = branch === "true" ? rule.true_mode : rule.false_mode;
+ const outputKey = branch === "true" ? rule.true_key : rule.false_key;
+ const colour = outputMode === "field" ? mappingSourceByKey(outputKey)?.value : (branch === "true" ? rule.true_value : rule.false_value);
if (!String(colour || "").trim()) return null;
return {
input: row.vmix_input_key || row.vmix_input_title || row.vmix_input_number,
@@ -1888,9 +1895,12 @@
const operatorOptions = [["gt", "> больше"], ["lt", "< меньше"], ["gte", "≥"], ["lte", "≤"], ["eq", "= равно"], ["neq", "≠ не равно"], ["contains", "содержит"], ["not_contains", "не содержит"], ["empty", "пусто"], ["not_empty", "не пусто"]]
.map(([value, label]) => ``).join("");
const summary = !rule.enabled ? "Правило выключено" : (rule.action === "visibility" ? `Visibility · ${rule.operator}` : `TextColour · ${rule.operator}`);
+ const colourSources = mappingRuleSources(row);
+ const colourOptions = (selectedKey) => `${selectedKey && !colourSources.some((item) => item.key === selectedKey) ? `` : ""}${colourSources.map((item) => ``).join("")}`;
+ const colourBranchEditor = (branch, title, mode, key, value, placeholder) => `
${mode === "field" ? `` : ``}
`;
const valueEditor = rule.action === "visibility"
? ``
- : ``;
+ : `${colourBranchEditor("true", "Цвет TRUE", rule.true_mode, rule.true_key, rule.true_value, "#E5CEA8 или red")}${colourBranchEditor("false", "Цвет ELSE", rule.false_mode, rule.false_key, rule.false_value, "#FFFFFF")}
`;
return `
@@ -1957,7 +1967,13 @@
const targetRow = mappingRowForField(profile, input, target.field.name);
if (!targetRow) continue;
const delta = target.index - sequence.anchorIndex;
- targetRow.rule = { ...rule, left_key: shiftKey(rule.left_key || row.data_key, delta), right_key: rule.right_mode === "field" ? shiftKey(rule.right_key, delta) : rule.right_key };
+ targetRow.rule = {
+ ...rule,
+ left_key: shiftKey(rule.left_key || row.data_key, delta),
+ right_key: rule.right_mode === "field" ? shiftKey(rule.right_key, delta) : rule.right_key,
+ true_key: rule.true_mode === "field" ? shiftKey(rule.true_key, delta) : rule.true_key,
+ false_key: rule.false_mode === "field" ? shiftKey(rule.false_key, delta) : rule.false_key,
+ };
changed += 1;
}
return { changed };
@@ -2128,6 +2144,8 @@
...rule,
left_key: shiftKey(rule.left_key || seed.data_key),
right_key: rule.right_mode === "field" ? shiftKey(rule.right_key) : rule.right_key,
+ true_key: rule.true_mode === "field" ? shiftKey(rule.true_key) : rule.true_key,
+ false_key: rule.false_mode === "field" ? shiftKey(rule.false_key) : rule.false_key,
};
}
@@ -3424,7 +3442,7 @@
modal.querySelectorAll("[data-map-rule-enabled]").forEach((control) => control.addEventListener("change", () => { mappingPatchRule(control.dataset.ruleField, { enabled: control.checked }); renderMapping(); }));
modal.querySelectorAll("[data-map-rule-action]").forEach((control) => control.addEventListener("change", () => {
const action = control.value;
- mappingPatchRule(control.dataset.ruleField, { action, true_value: action === "visibility" ? "on" : "#E5CEA8", false_value: action === "visibility" ? "off" : "#FFFFFF", enabled: true });
+ mappingPatchRule(control.dataset.ruleField, { action, true_mode: "value", true_key: "", true_value: action === "visibility" ? "on" : "#E5CEA8", false_mode: "value", false_key: "", false_value: action === "visibility" ? "off" : "#FFFFFF", enabled: true });
renderMapping();
}));
modal.querySelectorAll("[data-map-rule-left-key]").forEach((control) => control.addEventListener("change", () => { mappingPatchRule(control.dataset.ruleField, { left_key: control.value, enabled: true }); renderMapping(); }));
@@ -3432,6 +3450,16 @@
modal.querySelectorAll("[data-map-rule-right-mode]").forEach((control) => control.addEventListener("change", () => { mappingPatchRule(control.dataset.ruleField, { right_mode: control.value, enabled: true }); renderMapping(); }));
modal.querySelectorAll("[data-map-rule-right-key]").forEach((control) => control.addEventListener("change", () => { mappingPatchRule(control.dataset.ruleField, { right_key: control.value, enabled: true }); renderMapping(); }));
modal.querySelectorAll("[data-map-rule-right-value]").forEach((control) => control.addEventListener("change", () => { mappingPatchRule(control.dataset.ruleField, { right_value: control.value, enabled: true }); renderMapping(); }));
+ modal.querySelectorAll("[data-map-rule-colour-mode]").forEach((control) => control.addEventListener("change", () => {
+ const branch = control.dataset.mapRuleColourMode;
+ mappingPatchRule(control.dataset.ruleField, { [`${branch}_mode`]: control.value, enabled: true });
+ renderMapping();
+ }));
+ modal.querySelectorAll("[data-map-rule-colour-key]").forEach((control) => control.addEventListener("change", () => {
+ const branch = control.dataset.mapRuleColourKey;
+ mappingPatchRule(control.dataset.ruleField, { [`${branch}_key`]: control.value, enabled: true });
+ renderMapping();
+ }));
modal.querySelectorAll("[data-map-rule-true]").forEach((control) => control.addEventListener("change", () => { mappingPatchRule(control.dataset.ruleField, { true_value: control.value, enabled: true }); renderMapping(); }));
modal.querySelectorAll("[data-map-rule-false]").forEach((control) => control.addEventListener("change", () => { mappingPatchRule(control.dataset.ruleField, { false_value: control.value, enabled: true }); renderMapping(); }));
modal.querySelectorAll("[data-map-rule-preset]").forEach((button) => button.addEventListener("click", () => { mappingPatchRule(button.dataset.ruleField, { operator: button.dataset.mapRulePreset, right_mode: "field", enabled: true }); renderMapping(); }));