mirror of
https://dev.azure.com/hugendubel/ISA/_git/ISA-Frontend
synced 2025-12-31 09:37:15 +01:00
feat: add cyclic dependency detection in return process service and improve layout in return process item component
This commit is contained in:
@@ -30,8 +30,15 @@ export class ReturnProcessService {
|
||||
|
||||
let questionKey: string | undefined = questions.startsWithQuestion;
|
||||
const result: ReturnProcessQuestion[] = [];
|
||||
const visited = new Set<string>();
|
||||
|
||||
while (questionKey) {
|
||||
if (visited.has(questionKey)) {
|
||||
console.error('Cyclic question dependency detected', questionKey);
|
||||
break;
|
||||
}
|
||||
visited.add(questionKey);
|
||||
|
||||
const question = questions.questions.find((q) => q.key === questionKey);
|
||||
if (question) {
|
||||
result.push(question);
|
||||
@@ -68,7 +75,12 @@ export class ReturnProcessService {
|
||||
return;
|
||||
}
|
||||
|
||||
const visited = new Set<string>();
|
||||
function computeLongestPath(data: ReturnProcessQuestionInfo, startKey: string) {
|
||||
if (visited.has(startKey)) return 0;
|
||||
|
||||
visited.add(startKey);
|
||||
|
||||
const findDepth = (key: string | undefined): number => {
|
||||
if (!key) return 0;
|
||||
const question = data.questions.find((q) => q.key === key);
|
||||
|
||||
@@ -6,24 +6,27 @@
|
||||
}
|
||||
</div>
|
||||
<div class="return-process-item-body">
|
||||
<img
|
||||
sharedProductImage
|
||||
[ean]="process.product.ean"
|
||||
[alt]="process.product.name"
|
||||
class="return-process-item-body__product-image w-14"
|
||||
/>
|
||||
<div class="return-process-item-body__product-info">
|
||||
<div class="return-process-item-body__product-info-contibutors isa-text-body-2-bold">
|
||||
{{ process.product.contributors }}
|
||||
</div>
|
||||
<div class="return-process-item-body__product-info-name isa-text-body-2-regular">
|
||||
{{ process.product.name }}
|
||||
</div>
|
||||
<div class="return-process-item-body__product-info-format">
|
||||
<ng-icon [name]="process.product.format | lowercase"></ng-icon>
|
||||
<span class="truncate">{{ process.product.formatDetail }}</span>
|
||||
<div class="return-process-item-body__product">
|
||||
<img
|
||||
sharedProductImage
|
||||
[ean]="process.product.ean"
|
||||
[alt]="process.product.name"
|
||||
class="return-process-item-body__product-image w-14"
|
||||
/>
|
||||
<div class="return-process-item-body__product-info">
|
||||
<div class="return-process-item-body__product-info-contibutors isa-text-body-2-bold">
|
||||
{{ process.product.contributors }}
|
||||
</div>
|
||||
<div class="return-process-item-body__product-info-name isa-text-body-2-regular">
|
||||
{{ process.product.name }}
|
||||
</div>
|
||||
<div class="return-process-item-body__product-info-format">
|
||||
<ng-icon [name]="process.product.format | lowercase"></ng-icon>
|
||||
<span>{{ process.product.formatDetail }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<lib-return-process-questions
|
||||
[returnProcessId]="returnProcessId()"
|
||||
></lib-return-process-questions>
|
||||
|
||||
@@ -21,10 +21,21 @@
|
||||
}
|
||||
|
||||
.return-process-item-body {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 1.5rem;
|
||||
width: 100%;
|
||||
@apply grid grid-flow-row gap-6 pb-6 w-full;
|
||||
|
||||
@screen isa-desktop-l {
|
||||
@apply grid-flow-col;
|
||||
}
|
||||
}
|
||||
|
||||
.return-process-item-body__product {
|
||||
@apply grid grid-cols-[auto,1fr] gap-6 pb-6;
|
||||
|
||||
@apply border-b border-neutral-300;
|
||||
|
||||
@screen isa-desktop-l {
|
||||
@apply border-b-0;
|
||||
}
|
||||
}
|
||||
|
||||
.return-process-item-body__product-info {
|
||||
@@ -43,7 +54,5 @@
|
||||
}
|
||||
|
||||
[lib-return-process-questions] {
|
||||
flex-shrink: 0;
|
||||
flex-grow: 1;
|
||||
align-self: stretch;
|
||||
@apply flex-grow;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user