Skip to content

Commit

Permalink
Fix ensuing decisions, add e2e
Browse files Browse the repository at this point in the history
RISDEV-2683
  • Loading branch information
leonie-koch committed Nov 14, 2023
1 parent 96fa72b commit 4a3f3fd
Show file tree
Hide file tree
Showing 10 changed files with 531 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -520,10 +520,13 @@ public static DocumentUnit transformToDomain(DocumentationUnitDTO documentationU
List<PendingDecisionDTO> pendingDecisionDTOs = documentationUnitDTO.getPendingDecisions();

if (pendingDecisionDTOs != null || ensuingDecisionDTOs != null) {
EnsuingDecision[] ensuingDecisions = new EnsuingDecision[ensuingDecisionDTOs.size()];
for (EnsuingDecisionDTO currentDTO : ensuingDecisionDTOs) {
ensuingDecisions[currentDTO.getRank() - 1] =
EnsuingDecisionTransformer.transformToDomain(currentDTO);
EnsuingDecision[] ensuingDecisions =
new EnsuingDecision[ensuingDecisionDTOs.size() + pendingDecisionDTOs.size()];
if (ensuingDecisionDTOs != null) {
for (EnsuingDecisionDTO currentDTO : ensuingDecisionDTOs) {
ensuingDecisions[currentDTO.getRank() - 1] =
EnsuingDecisionTransformer.transformToDomain(currentDTO);
}
}

if (pendingDecisionDTOs != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static EnsuingDecision transformToDomain(EnsuingDecisionDTO ensuingDecisi
.documentType(getDocumentTypeFromDTO(ensuingDecisionDTO.getDocumentType()))
.decisionDate(ensuingDecisionDTO.getDate())
.note(ensuingDecisionDTO.getNote())
.isPending(false)
.pending(false)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static EnsuingDecision transformToDomain(PendingDecisionDTO pendingDecisi
.documentType(getDocumentTypeFromDTO(pendingDecisionDTO.getDocumentType()))
.decisionDate(pendingDecisionDTO.getDate())
.note(pendingDecisionDTO.getNote())
.isPending(true)
.pending(true)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@DateKnownConstraint
@Data
public class EnsuingDecision extends RelatedDocumentationUnit {
private boolean isPending;
private boolean pending;
private String note;

public boolean hasNoValues() {
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/EnsuingDecisionInputGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ const searchResultsCurrentPage = ref<Page<EnsuingDecision>>()
const searchResults = ref<SearchResults<EnsuingDecision>>()
const isPending = computed({
get: () => ensuingDecision.value.isPending,
get: () => ensuingDecision.value.pending,
set: (value) => {
if (value) ensuingDecision.value.decisionDate = undefined
ensuingDecision.value.isPending = value
ensuingDecision.value.pending = value
},
})
Expand Down Expand Up @@ -146,7 +146,7 @@ onMounted(() => {
<ComboboxInput
id="court"
v-model="ensuingDecision.court"
aria-label="Gericht Nachgehende Entschiedung"
aria-label="Gericht Nachgehende Entscheidung"
clear-on-choosing-item
:has-error="slotProps.hasError"
:item-service="ComboboxItemService.getCourts"
Expand All @@ -164,7 +164,7 @@ onMounted(() => {
<DateInput
id="decisionDate"
v-model="ensuingDecision.decisionDate"
aria-label="Entscheidungsdatum Nachgehende Entschiedung"
aria-label="Entscheidungsdatum Nachgehende Entscheidung"
:has-error="slotProps.hasError"
@focus="validationStore.remove('decisionDate')"
@update:validation-error="slotProps.updateValidationError"
Expand All @@ -184,7 +184,7 @@ onMounted(() => {
<TextInput
id="fileNumber"
v-model="ensuingDecision.fileNumber"
aria-label="Aktenzeichen Nachgehende Entschiedung"
aria-label="Aktenzeichen Nachgehende Entscheidung"
:has-error="slotProps.hasError"
placeholder="Aktenzeichen"
@input="validationStore.remove('fileNumber')"
Expand All @@ -199,7 +199,7 @@ onMounted(() => {
<ComboboxInput
id="documentType"
v-model="ensuingDecision.documentType"
aria-label="Dokumenttyp Nachgehende Entschiedung"
aria-label="Dokumenttyp Nachgehende Entscheidung"
:item-service="ComboboxItemService.getDocumentTypes"
placeholder="Bitte auswählen"
></ComboboxInput>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/EnsuingDecisions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const ensuingDecisions = computed({
return props.modelValue
},
set: (value) => {
if (value) emit("update:modelValue", value)
emit("update:modelValue", value)
},
})
const defaultValue = new EnsuingDecision()
Expand All @@ -29,7 +29,7 @@ function decisionSummarizer(dataEntry: EnsuingDecision) {
!dataEntry.hasMissingRequiredFields ||
(dataEntry.missingRequiredFields.length === 1 &&
dataEntry.missingRequiredFields[0] === "decisionDate" &&
dataEntry.isPending)
dataEntry.pending)
) {
return h("div", { class: ["link-02-reg"] }, dataEntry.renderDecision)
} else {
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/domain/ensuingDecision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ export default class EnsuingDecision
extends RelatedDocumentation
implements EditableListItem
{
public isPending = false
public pending: boolean | undefined
public note: string | undefined

static requiredFields = ["fileNumber", "court", "decisionDate"] as const
static fields = [
"isPending",
"pending",
"fileNumber",
"court",
"decisionDate",
Expand All @@ -26,12 +26,12 @@ export default class EnsuingDecision

get renderDecision(): string {
return [
...(this.isPending === true ? ["anhängig"] : ["nachgehend"]),
...(this.pending === true ? ["anhängig"] : ["nachgehend"]),
...(this.court ? [`${this.court.label}`] : []),
...(this.decisionDate
? [dayjs(this.decisionDate).format("DD.MM.YYYY")]
: []),
...(this.isPending ? ["Datum unbekannt"] : []),
...(this.pending ? ["Datum unbekannt"] : []),
...(this.fileNumber ? [this.fileNumber] : []),
...(this.documentType ? [this.documentType?.jurisShortcut] : []),
...(this.note ? [this.note] : []),
Expand Down Expand Up @@ -70,7 +70,7 @@ export default class EnsuingDecision
fieldName: keyof EnsuingDecision,
value: EnsuingDecision[(typeof EnsuingDecision.fields)[number]],
) {
if (fieldName === "isPending" && value === true) {
if (fieldName === "pending" && value === true) {
return false
}
if (value === undefined || !value || value === null) {
Expand Down
Loading

0 comments on commit 4a3f3fd

Please sign in to comment.