mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-26 21:53:06 +00:00
B134 — placeholder de rationale quando motivo de nível omitido
Co-authored-by: Francisco Solla <fsolla@users.noreply.github.com>
This commit is contained in:
parent
28ff9615ce
commit
dccca44ddd
3 changed files with 6 additions and 2 deletions
|
|
@ -3,6 +3,7 @@
|
|||
import type { Payload } from 'payload'
|
||||
|
||||
import {
|
||||
ENGAGEMENT_LEVEL_NO_RATIONALE_LABEL,
|
||||
ENGAGEMENT_LEVEL_PATTERN_ID,
|
||||
EngagementLevelBlockedError,
|
||||
getEngagementLevelViolations,
|
||||
|
|
@ -205,7 +206,7 @@ export const setMunicipalityEngagementLevelRecord = async (
|
|||
municipality,
|
||||
patternId: ENGAGEMENT_LEVEL_PATTERN_ID,
|
||||
outcome: 'movimento',
|
||||
rationale: levelNote ?? '',
|
||||
rationale: levelNote?.trim() ? levelNote : ENGAGEMENT_LEVEL_NO_RATIONALE_LABEL,
|
||||
// Only the values the decision was taken on — no document dumps
|
||||
// (the collection caps the serialized snapshot at 16 KB).
|
||||
snapshot: {
|
||||
|
|
|
|||
|
|
@ -19,6 +19,9 @@ export const ENGAGEMENT_LEVEL_PATTERN_ID = 'nivel'
|
|||
/** Cap shared by the field, the schema and the textareas, so they agree. */
|
||||
export const ENGAGEMENT_LEVEL_TEXT_MAX_LENGTH = 2000
|
||||
|
||||
/** Filed on `allocationDecision.rationale` when the coordinator omits a motivo (B134). */
|
||||
export const ENGAGEMENT_LEVEL_NO_RATIONALE_LABEL = 'Sem justificativa registrada.'
|
||||
|
||||
export type EngagementLevel = (typeof engagementLevels)[number]
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ describe('municipality engagement level (E14)', () => {
|
|||
const decision = decisions.docs[0]!
|
||||
fixtures.own('allocationDecision', decision.id)
|
||||
|
||||
expect(decision.rationale).toBe('')
|
||||
expect(decision.rationale).toBe('Sem justificativa registrada.')
|
||||
expect(decision.snapshot).toMatchObject({
|
||||
from: null,
|
||||
to: 'n1',
|
||||
|
|
|
|||
Loading…
Reference in a new issue