Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
RISDEV-2741
  • Loading branch information
HPrinz committed Nov 24, 2023
1 parent 0ef3441 commit 5b4ecb5
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ public static EnsuingDecision transformToDomain(EnsuingDecisionDTO ensuingDecisi
.uuid(ensuingDecisionDTO.getId())
.documentNumber(ensuingDecisionDTO.getDocumentNumber())
.referencedDocumentationUnitId(
ensuingDecisionDTO.getReferencedDocumentationUnitId() == null
ensuingDecisionDTO.getReferencedDocumentationUnit() == null
? null
: ensuingDecisionDTO.getReferencedDocumentationUnitId())
: ensuingDecisionDTO.getReferencedDocumentationUnit().getId())
.court(getCourtFromDTO(ensuingDecisionDTO.getCourt()))
.fileNumber(getFileNumber(ensuingDecisionDTO.getFileNumber()))
.documentType(getDocumentTypeFromDTO(ensuingDecisionDTO.getDocumentType()))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package de.bund.digitalservice.ris.caselaw.adapter.transformer;

import de.bund.digitalservice.ris.caselaw.adapter.database.jpa.DocumentationUnitDTO;
import de.bund.digitalservice.ris.caselaw.adapter.database.jpa.PendingDecisionDTO;
import de.bund.digitalservice.ris.caselaw.domain.EnsuingDecision;

Expand All @@ -8,6 +9,10 @@ public static EnsuingDecision transformToDomain(PendingDecisionDTO pendingDecisi
return EnsuingDecision.builder()
.uuid(pendingDecisionDTO.getId())
.documentNumber(pendingDecisionDTO.getDocumentNumber())
.referencedDocumentationUnitId(
pendingDecisionDTO.getReferencedDocumentationUnit() == null
? null
: pendingDecisionDTO.getReferencedDocumentationUnit().getId())
.court(getCourtFromDTO(pendingDecisionDTO.getCourt()))
.fileNumber(getFileNumber(pendingDecisionDTO.getFileNumber()))
.documentType(getDocumentTypeFromDTO(pendingDecisionDTO.getDocumentType()))
Expand All @@ -27,6 +32,12 @@ public static PendingDecisionDTO transformToDTO(EnsuingDecision ensuingDecision)
.court(getCourtFromDomain(ensuingDecision.getCourt()))
.date(ensuingDecision.getDecisionDate())
.documentNumber(ensuingDecision.getDocumentNumber())
.referencedDocumentationUnit(
ensuingDecision.getReferencedDocumentationUnitId() == null
? null
: DocumentationUnitDTO.builder()
.id(ensuingDecision.getReferencedDocumentationUnitId())
.build())
.documentType(getDocumentTypeFromDomain(ensuingDecision.getDocumentType()))
.fileNumber(getFileNumber(ensuingDecision.getFileNumber()))
.note(ensuingDecision.getNote())
Expand Down
17 changes: 16 additions & 1 deletion frontend/src/components/EnsuingDecisions.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts" setup>
import { h, computed } from "vue"
import { RouterLink } from "vue-router"
import EnsuingDecisionInputGroup from "./EnsuingDecisionInputGroup.vue"
import EditableList from "@/components/EditableListCaselaw.vue"
import EnsuingDecision from "@/domain/ensuingDecision"
Expand All @@ -25,7 +26,21 @@ const ensuingDecisions = computed({
const defaultValue = new EnsuingDecision()
function decisionSummarizer(dataEntry: EnsuingDecision) {
if (
if (dataEntry.isReadOnly) {
return h(
RouterLink,
{
class: ["ds-link-01-bold", "underline"],
target: "_blank",
tabindex: -1,
to: {
name: "caselaw-documentUnit-documentNumber-categories",
params: { documentNumber: dataEntry.documentNumber },
},
},
() => dataEntry.renderDecision,
)
} else if (
!dataEntry.hasMissingRequiredFields ||
(dataEntry.missingRequiredFields.length === 1 &&
dataEntry.missingRequiredFields[0] === "decisionDate" &&
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/domain/ensuingDecision.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default class EnsuingDecision
}

get isReadOnly(): boolean {
return false
return this.hasForeignSource
}

get isEmpty(): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ test.describe("active citations", () => {
court: prefilledDocumentUnit.coreData.court?.label,
fileNumber: prefilledDocumentUnit.coreData.fileNumbers?.[0],
documentType: prefilledDocumentUnit.coreData.documentType?.jurisShortcut,
decisionDate: "01.01.2020",
decisionDate: "31.12.2019",
})

const activeCitationContainer = page.getByLabel("Aktivzitierung")
Expand All @@ -245,15 +245,15 @@ test.describe("active citations", () => {

//citation style ignored in search results
const result = page.getByText(
`AG Aachen, 01.01.2020, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, Anerkenntnisurteil, ${prefilledDocumentUnit.documentNumber}`,
`AG Aachen, 31.12.2019, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, Anerkenntnisurteil, ${prefilledDocumentUnit.documentNumber}`,
)

await expect(result).toBeVisible()
await page.getByLabel("Treffer übernehmen").click()

//make sure to have citation style in list
const listItem = page.getByText(
`Änderung, AG Aachen, 01.01.2020, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, Anerkenntnisurteil, ${prefilledDocumentUnit.documentNumber}`,
`Änderung, AG Aachen, 31.12.2019, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, Anerkenntnisurteil, ${prefilledDocumentUnit.documentNumber}`,
)
await expect(listItem).toBeVisible()
await expect(page.getByLabel("Eintrag löschen")).toBeVisible()
Expand All @@ -268,7 +268,7 @@ test.describe("active citations", () => {
court: prefilledDocumentUnit.coreData.court?.label,
fileNumber: prefilledDocumentUnit.coreData.fileNumbers?.[0],
documentType: prefilledDocumentUnit.coreData.documentType?.jurisShortcut,
decisionDate: "01.01.2020",
decisionDate: "31.12.2019",
})

await activeCitationContainer.getByLabel("Nach Entscheidung suchen").click()
Expand Down Expand Up @@ -312,7 +312,7 @@ test.describe("active citations", () => {
court: prefilledDocumentUnit.coreData.court?.label,
fileNumber: prefilledDocumentUnit.coreData.fileNumbers?.[0],
documentType: prefilledDocumentUnit.coreData.documentType?.jurisShortcut,
decisionDate: "01.01.2020",
decisionDate: "31.12.2019",
})
await page.getByLabel("Aktivzitierung speichern").click()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ test.describe("ensuing decisions", () => {
court: prefilledDocumentUnit.coreData.court?.label,
fileNumber: prefilledDocumentUnit.coreData.fileNumbers?.[0],
documentType: prefilledDocumentUnit.coreData.documentType?.jurisShortcut,
decisionDate: "01.01.2020",
decisionDate: "31.12.2019",
})
const ensuingDecisionContainer = page.getByLabel("Nachgehende Entscheidung")
await ensuingDecisionContainer
Expand All @@ -328,15 +328,15 @@ test.describe("ensuing decisions", () => {
await expect(page.getByText("1 Ergebnis gefunden.")).toBeVisible()

const result = page.getByText(
`AG Aachen, 01.01.2020, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
`nachgehend, AG Aachen, 31.12.2019, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
)

await expect(result).toBeVisible()
await page.getByLabel("Treffer übernehmen").click()

//make sure to have citation style in list
const listItem = page.getByText(
`AG Aachen, 01.01.2020, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
`nachgehend, AG Aachen, 31.12.2019, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
)
await expect(listItem).toBeVisible()
await expect(page.getByLabel("Eintrag löschen")).toBeVisible()
Expand All @@ -350,7 +350,7 @@ test.describe("ensuing decisions", () => {
court: prefilledDocumentUnit.coreData.court?.label,
fileNumber: prefilledDocumentUnit.coreData.fileNumbers?.[0],
documentType: prefilledDocumentUnit.coreData.documentType?.jurisShortcut,
decisionDate: "01.01.2020",
decisionDate: "31.12.2019",
})

await ensuingDecisionContainer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ test.describe("previous decisions", () => {
court: prefilledDocumentUnit.coreData.court?.label,
fileNumber: prefilledDocumentUnit.coreData.fileNumbers?.[0],
documentType: prefilledDocumentUnit.coreData.documentType?.jurisShortcut,
decisionDate: "01.01.2020",
decisionDate: "31.12.2019",
})
const previousDecisionContainer = page.getByLabel("Vorgehende Entscheidung")
await previousDecisionContainer
Expand All @@ -263,15 +263,15 @@ test.describe("previous decisions", () => {
await expect(page.getByText("1 Ergebnis gefunden.")).toBeVisible()

const result = page.getByText(
`AG Aachen, 01.01.2020, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
`AG Aachen, 31.12.2019, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
)

await expect(result).toBeVisible()
await page.getByLabel("Treffer übernehmen").click()

//make sure to have citation style in list
const listItem = page.getByText(
`AG Aachen, 01.01.2020, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
`AG Aachen, 31.12.2019, ${prefilledDocumentUnit.coreData.fileNumbers?.[0]}, AnU, ${prefilledDocumentUnit.documentNumber}`,
)
await expect(listItem).toBeVisible()
await expect(page.getByLabel("Eintrag löschen")).toBeVisible()
Expand All @@ -285,7 +285,7 @@ test.describe("previous decisions", () => {
court: prefilledDocumentUnit.coreData.court?.label,
fileNumber: prefilledDocumentUnit.coreData.fileNumbers?.[0],
documentType: prefilledDocumentUnit.coreData.documentType?.jurisShortcut,
decisionDate: "01.01.2020",
decisionDate: "31.12.2019",
})

await previousDecisionContainer
Expand Down

0 comments on commit 5b4ecb5

Please sign in to comment.