-
Notifications
You must be signed in to change notification settings - Fork 5
1331 oprava zaškrtávátka na korektury navrhy #683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1331-oprava-zaškrtávátka-na-korektury
Are you sure you want to change the base?
The head ref may contain hidden characters: "1331-oprava-za\u0161krt\u00E1v\u00E1tka-na-korektury-navrhy"
1331 oprava zaškrtávátka na korektury navrhy #683
Conversation
@@ -113,12 +113,21 @@ | |||
back(); | |||
} | |||
|
|||
if (post("korekce")) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Když někdo v přehledu aktivit chce změnit korekci...
systemoveNastaveni: $systemoveNastaveni, | ||
); | ||
$a?->nastavKorekci(!$a->probehlaKorekce()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...tak to prohodilo současný stav korekce na aktivitě - ale to nemuselo být to, co uživatel chtěl - když stránka zalaguje, tak uživatel zuřivě kliká na odeslat (nebo prostě mařkiá F5 a potvrzuje opětovné odeslání formuláře) a na backendu se korekce přepíná sem a tam, zatímco uživatel chce "ten stav co jednou nastavil a snaží se ho uložit"
@@ -187,6 +196,7 @@ | |||
$tpl->parse('aktivity.aktivita.symbolInstance'); | |||
} | |||
if ($u->maPravo(Pravo::PROVADI_KOREKCE)) { | |||
$tpl->assign('opacnyStavKorekce', $aktivita->probehlaKorekce() ? 1 : 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Už neposíláme jenom 1 = uživatel chce změnit korekci, ale rovnou stav, na který se korekce přepne, když uživatel odešle změnu
@@ -24,7 +25,7 @@ | |||
|
|||
/** @var Logovac $vyjimkovac */ | |||
try { | |||
if ($a = Aktivita::editorZpracuj()) { // úspěšné uložení změn ve formuláři | |||
if ($a = Aktivita::editorZpracuj($u?->maPravoNaProvadeniKorekci())) { // úspěšné uložení změn ve formuláři |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Abychom věděli, že uživatel může korekci kontrolovat
Sql::PATRI_POD . ' = (SELECT a.' . Sql::PATRI_POD . | ||
' FROM ' . Sql::AKCE_SEZNAM_TABULKA . ' a' . | ||
' WHERE a.' . Sql::ID_AKCE . ' = ' . $this->id() . '))', | ||
dbQuery(<<<SQL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navrhuju SQL přepsat do nativního
if (array_key_exists(Sql::PROBEHLA_KOREKCE, $data) /** editace korekce; reakce na změnu textu viz @see popis */ | ||
$nastavujeKorekci = empty($data[Sql::ID_AKCE]) /* nová aktivita */ | ||
|| $maPravoNaProvadeniKorekci | ||
|| ($maPravoNaProvadeniKorekci === null && array_key_exists(Sql::PROBEHLA_KOREKCE, $data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array_key_exists(Sql::PROBEHLA_KOREKCE, $data)
je chyták - když je checkbox odškrtnutý, tady ve významu "ruším potvrzení předchozí korektury", tak ho browser na BE neodešle vůbec .
Takže odškrtnutý checkbox nikdy v $data
není a my z dat nepoznáme, jestli se checkbox vůbec nezobrazil, nebo ho uživatel odškrtnul.
Navrhuju to vyřešit přes práva - když uživatel má právo na korekturu, tak se mu určitě checbox zobrazil a já můžu brát empty($data[Sql::PROBEHLA_KOREKCE])
jako odškrtnutí.
AND a.probehla_korekce = 1 | ||
AND EXISTS(SELECT 1 FROM texty t JOIN akce_seznam aa ON aa.popis = t.id WHERE t.text = $1 AND aa.probehla_korekce = 1) | ||
)', | ||
[0 => $data[Sql::NAZEV_AKCE], 1 => $data[Sql::POPIS], 2 => $data[Sql::POPIS_KRATKY]], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jenom jsem přidal explicitní indexy pro pole parametrů, aby bylo jasné co k čemu patří (0 => $data[Sql::NAZEV_AKCE]
= nazev akce = $0
atd)
@@ -1406,12 +1417,12 @@ private function seznamUcastniku(?DataSourcesCollector $dataSourcesCollector = n | |||
return $this->seznamUcastniku; | |||
} | |||
|
|||
private static function seznamUcastnikuDSC(?DataSourcesCollector $dataSourcesCollector): void { | |||
private static function seznamUcastnikuDSC(?DataSourcesCollector $dataSourcesCollector): void |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Autoformát, pardon, můžeš si vypnout zobrazování bílých znaků v diffu, aby se CR dělalo snáz
#655