Skip to content
Snippets Groups Projects
Commit 05efa274 authored by Kawtar Laariche's avatar Kawtar Laariche
Browse files

#22: :bug: show the latest version id

parent c6aa8629
No related branches found
No related tags found
No related merge requests found
......@@ -58,12 +58,12 @@ interface SolutionData {
revisionId: string;
solution: PublicSolutionDetailsModel;
catalogs: Catalog[];
picture: any;
averageRatings: AverageRatings;
allRatings: AllUserRating[];
picture?: any;
averageRatings?: AverageRatings;
allRatings?: AllUserRating[];
comments: any;
authors: AuthorPublisherModel[];
relatedSolutions: PublicSolution[];
relatedSolutions?: PublicSolution[];
}
@Component({
......@@ -163,6 +163,9 @@ export class ModelDetailsComponent implements OnInit {
.pipe(map((details) => !!details?.userId));
this.data$ = this.activatedRoute.params.pipe(
tap((params) => {
console.log({ params });
}),
map((params) => ({
solutionId: params['solutionId'] as string,
revisionId: params['revisionId'] as string,
......@@ -178,22 +181,26 @@ export class ModelDetailsComponent implements OnInit {
solution: of(solution),
catalogs:
this.publicSolutionsService.getCatalogsOfSolution(solutionId),
picture:
this.publicSolutionsService.getPictureOfSolution(solutionId),
averageRatings:
this.publicSolutionsService.getAverageRatings(solutionId),
allRatings:
this.publicSolutionsService.getAllRatings(solutionId),
comments: this.publicSolutionsService.getComment(
solutionId,
revisionId,
),
authors: this.publicSolutionsService.getModelAuthors(
solutionId,
revisionId,
),
relatedSolutions:
this.publicSolutionsService.relatedSolutions(solution),
picture: this.publicSolutionsService
.getPictureOfSolution(solutionId)
.pipe(catchError(() => of(null))),
averageRatings: this.publicSolutionsService
.getAverageRatings(solutionId)
.pipe(catchError(() => of({} as AverageRatings))),
allRatings: this.publicSolutionsService
.getAllRatings(solutionId)
.pipe(catchError(() => of([]))),
comments: this.publicSolutionsService
.getComment(solutionId, revisionId)
.pipe(
catchError(() => of({ response_body: { content: [] } })),
),
authors: this.publicSolutionsService
.getModelAuthors(solutionId, revisionId)
.pipe(catchError(() => of([]))),
relatedSolutions: this.publicSolutionsService
.relatedSolutions(solution)
.pipe(catchError(() => of([]))),
}),
),
tap((data) => {
......@@ -424,7 +431,9 @@ export class ModelDetailsComponent implements OnInit {
private processSideEffects(data: SolutionData): void {
this.revisionsList = this.getRevisionsList(data.solution);
this.selectedDefaultRevision = this.revisionsList[0];
this.selectedDefaultRevision = this.revisionsList.filter(
(rv) => rv.revisionId === this.revisionId,
)[0];
this.setRevisionInService(this.selectedDefaultRevision);
if (data.catalogs.length > 0) {
......@@ -433,10 +442,10 @@ export class ModelDetailsComponent implements OnInit {
}
this.setVersionIdInService();
this.createImageFromBlob(data.picture);
this.updateStarWidth(data.averageRatings);
this.calculateRatings(data.allRatings);
this.updateStarWidth(data.averageRatings || ({} as AverageRatings));
this.calculateRatings(data.allRatings || []);
this.setAuthorListInService(data.authors);
this.removeCurrentSolution(data.relatedSolutions, data.solution);
this.removeCurrentSolution(data.relatedSolutions || [], data.solution);
}
triggerDeployment(menuEntry: {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment