api#347: сохранить part в именованных наборах и процентных контрактах

This commit is contained in:
Panfilov Konstantin committed 2026-10-28 05:06:11 +03:00
1 parent 1993f7b4b1
commit f7d1792e23
10 files changed
+17 -13

No files matched your search

+1
View File
@@ -74,6 +74,7 @@ final class Config
$number=static function($value) use($maps,$canonical): string {
if (!is_int($value) && !is_string($value)) throw new Problem('Вариант UTM должен быть номером.');
$value=(string)$value;
if ($canonical==='part' && !in_array($value,['1','2'],true)) throw new Problem('Вариант part должен быть 1 или 2.');
if (isset($maps[$canonical])) { $digit=array_search($value,$maps[$canonical],true); if ($digit!==false) return (string)$digit; }
if (!preg_match('/^[1-9]$/D',$value)) throw new Problem('Вариант UTM должен быть 1–9.');
return $value;
+1 -1
View File
@@ -5,7 +5,7 @@ namespace PrelandAdmin;
/** Явная миграция #28: заменяет исключительно числовые токены известных весов. */
final class PercentMigration
{
private const KEYS=['indpic','theme','degr','reg','registration','banch','chob','bchoice','tp','cons','focus'];
private const KEYS=['indpic','theme','degr','reg','registration','banch','chob','bchoice','tp','cons','focus','part'];
public static function patch(string $raw): string
{
+1 -1
View File
@@ -5,7 +5,7 @@ namespace PrelandAdmin;
/** Контракт хранимых процентов. Миграция вызывается только явно, отдельно от чтения и записи. */
final class PercentWeights
{
public const GROUPS=['indpic','theme','degr','reg','registration','banch','chob','bchoice','tp','cons','focus'];
public const GROUPS=['indpic','theme','degr','reg','registration','banch','chob','bchoice','tp','cons','focus','part'];
private static function groups(\stdClass $config): array
{
+1 -1
View File
@@ -5,7 +5,7 @@ namespace PrelandAdmin;
/** Независимые снимки UTM: без доменов, подключений, заметок и происхождения. */
final class UtmPresets
{
private const GROUPS=['indpic','theme','degr','reg','banch','tp','cons','focus'];
private const GROUPS=['indpic','theme','degr','reg','banch','tp','cons','focus','part'];
public function __construct(private Store $store) {}
public function all(): array {
return array_values(array_map(static fn($p)=>['id'=>$p['id'],'name'=>$p['name']],$this->store->read('utm-presets.json')));