mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-27 06:13: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 type { Payload } from 'payload'
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
ENGAGEMENT_LEVEL_NO_RATIONALE_LABEL,
|
||||||
ENGAGEMENT_LEVEL_PATTERN_ID,
|
ENGAGEMENT_LEVEL_PATTERN_ID,
|
||||||
EngagementLevelBlockedError,
|
EngagementLevelBlockedError,
|
||||||
getEngagementLevelViolations,
|
getEngagementLevelViolations,
|
||||||
|
|
@ -205,7 +206,7 @@ export const setMunicipalityEngagementLevelRecord = async (
|
||||||
municipality,
|
municipality,
|
||||||
patternId: ENGAGEMENT_LEVEL_PATTERN_ID,
|
patternId: ENGAGEMENT_LEVEL_PATTERN_ID,
|
||||||
outcome: 'movimento',
|
outcome: 'movimento',
|
||||||
rationale: levelNote ?? '',
|
rationale: levelNote?.trim() ? levelNote : ENGAGEMENT_LEVEL_NO_RATIONALE_LABEL,
|
||||||
// Only the values the decision was taken on — no document dumps
|
// Only the values the decision was taken on — no document dumps
|
||||||
// (the collection caps the serialized snapshot at 16 KB).
|
// (the collection caps the serialized snapshot at 16 KB).
|
||||||
snapshot: {
|
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. */
|
/** Cap shared by the field, the schema and the textareas, so they agree. */
|
||||||
export const ENGAGEMENT_LEVEL_TEXT_MAX_LENGTH = 2000
|
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]
|
export type EngagementLevel = (typeof engagementLevels)[number]
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ describe('municipality engagement level (E14)', () => {
|
||||||
const decision = decisions.docs[0]!
|
const decision = decisions.docs[0]!
|
||||||
fixtures.own('allocationDecision', decision.id)
|
fixtures.own('allocationDecision', decision.id)
|
||||||
|
|
||||||
expect(decision.rationale).toBe('')
|
expect(decision.rationale).toBe('Sem justificativa registrada.')
|
||||||
expect(decision.snapshot).toMatchObject({
|
expect(decision.snapshot).toMatchObject({
|
||||||
from: null,
|
from: null,
|
||||||
to: 'n1',
|
to: 'n1',
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue