This is the codeAbility Sharing Platform! Learn more about the codeAbility Sharing Platform.

Skip to content
Snippets Groups Projects
Commit d2e2fb78 authored by Eduard Frankford's avatar Eduard Frankford
Browse files

fix wrong resource link

parent e93711b5
Branches
2 merge requests!211Merge new meta data indexing,!210414 resource link wrong
......@@ -115,7 +115,7 @@ export class PeerReviewingComponent implements OnInit {
selectExercise(gitlabURL: string): ExtendedSearchResultDTO {
const exercise: ExtendedSearchResultDTO = this.exerciseService.populateExerciseWithData(
this.allExercises.find(exercise => exercise.project.url == gitlabURL)!
this.allExercises.find(exercise => this.reviewManagementService.getGitLabUrl(exercise) == gitlabURL)!
);
return exercise;
}
......
......@@ -105,7 +105,7 @@ export class ReviewManagementComponent implements OnInit, OnChanges {
this.selectedExercise!.metadata.title,
this.selectedExercise!.exerciseId,
this.selectedUsers!,
this.selectedExercise!.project.url
this.reviewManagementService.getGitLabUrl(this.selectedExercise!)
)
)
.subscribe(() => {
......
......@@ -5,6 +5,7 @@ import { ApplicationConfigService } from 'app/core/config/application-config.ser
import { ReviewRequest } from './reviewRequest.model';
import { Review, ReviewStatisticsDTO } from './review.model';
import { ReviewRating } from './reviewRating.model';
import { SearchResultDTO } from 'app/shared/model/search/search-result-dto.model';
@Injectable({ providedIn: 'root' })
export class ReviewManagementService {
......@@ -99,4 +100,14 @@ export class ReviewManagementService {
getAllReviewRatings(): Observable<ReviewRating[]> {
return this.http.get<ReviewRating[]>(this.resourceUrl + '/reviewRatings');
}
getGitLabUrl(exercise: SearchResultDTO): string {
const lastSlashPos = exercise?.file.path.lastIndexOf('/');
if (!lastSlashPos || lastSlashPos <= 0) {
return exercise.project.url;
}
const prefix = exercise.file.path.substring(0, lastSlashPos);
const branch = 'main';
return `${exercise.project.url}/-/tree/${branch}/${prefix}`;
}
}
......@@ -102,7 +102,7 @@ export class ReviewsComponent implements OnInit, OnChanges {
this.selectedExercise!.metadata.title,
this.selectedExercise!.exerciseId,
this.selectedUsers!,
this.selectedExercise!.project.url
this.reviewManagementService.getGitLabUrl(this.selectedExercise!)
)
)
.subscribe(() => {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment