Skip to content

Commit

Permalink
ramona feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
az108 committed Nov 14, 2024
1 parent be28769 commit fe3cb3b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
Expand Down Expand Up @@ -365,9 +366,11 @@ public ResponseEntity<Long> getMaxCount(@PathVariable long exerciseId) {
*/
@GetMapping("exercises/{exerciseId}/feedback-details-participation")
@EnforceAtLeastEditorInExercise
public ResponseEntity<Page<FeedbackAffectedStudentDTO>> getAffectedStudentsWithFeedback(@PathVariable long exerciseId, @RequestParam String feedbackIds,
public ResponseEntity<Page<FeedbackAffectedStudentDTO>> getAffectedStudentsWithFeedback(@PathVariable long exerciseId, @RequestHeader("feedbackIds") String feedbackIdsHeader,
@ModelAttribute PageableSearchDTO<String> data) {
Page<FeedbackAffectedStudentDTO> participation = resultService.getAffectedStudentsWithFeedbackId(exerciseId, feedbackIds, data);

Page<FeedbackAffectedStudentDTO> participation = resultService.getAffectedStudentsWithFeedbackId(exerciseId, feedbackIdsHeader, data);

return ResponseEntity.ok(participation);
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable } from '@angular/core';
import { PageableResult, PageableSearch, SearchResult, SearchTermPageableSearch } from 'app/shared/table/pageable-table';
import { BaseApiHttpService } from 'app/course/learning-paths/services/base-api-http.service';
import { HttpParams } from '@angular/common/http';
import { HttpHeaders, HttpParams } from '@angular/common/http';
import { FilterData } from 'app/exercises/programming/manage/grading/feedback-analysis/Modal/feedback-filter-modal.component';

export interface FeedbackAnalysisResponse {
Expand Down Expand Up @@ -50,13 +50,16 @@ export class FeedbackAnalysisService extends BaseApiHttpService {
}

async getParticipationForFeedbackIds(exerciseId: number, feedbackIds: number[], pageable: PageableSearch): Promise<PageableResult<FeedbackAffectedStudentDTO>> {
const feedbackIdsHeader = feedbackIds.join(',');

const params = new HttpParams()
.set('feedbackIds', feedbackIds.join(','))
.set('page', pageable.page.toString())
.set('pageSize', pageable.pageSize.toString())
.set('sortedColumn', pageable.sortedColumn)
.set('sortingOrder', pageable.sortingOrder);

return this.get<PageableResult<FeedbackAffectedStudentDTO>>(`exercises/${exerciseId}/feedback-details-participation`, { params });
const headers = new HttpHeaders().set('feedbackIds', feedbackIdsHeader);

return this.get<PageableResult<FeedbackAffectedStudentDTO>>(`exercises/${exerciseId}/feedback-details-participation`, { params, headers });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ describe('FeedbackAnalysisService', () => {

const responsePromise = service.getParticipationForFeedbackIds(1, feedbackIds, pageable);

const req = httpMock.expectOne('api/exercises/1/feedback-details-participation?feedbackIds=1,2&page=1&pageSize=10&sortedColumn=participationId&sortingOrder=ASCENDING');
const req = httpMock.expectOne('api/exercises/1/feedback-details-participation?page=1&pageSize=10&sortedColumn=participationId&sortingOrder=ASCENDING');
expect(req.request.method).toBe('GET');
req.flush(participationResponseMock);

Expand Down

0 comments on commit fe3cb3b

Please sign in to comment.