Skip to content
Snippets Groups Projects
Commit 9ce2c510 authored by Danae Savvidi's avatar Danae Savvidi :laughing:
Browse files

fixes

parent bcb182bc
Branches
No related tags found
1 merge request!345Resolve "TA Statistics - Star Rating"
Pipeline #1236298 failed
......@@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added JobHolder and Project Entity @mmadara
### Changed
- Queue feedback rating link replaced with actual rating. @dsavvidi
### Fixed
......@@ -77,7 +78,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Default trainings can be configures for a programme. These are required for any job offer of the programme. @rwbackx
### Changed
- Queue feedback rating link replaced with actual rating. @dsavvidi
- Job offer applications are sorted based on the time of application @dsavvidi
- The coordinator view for applications has been split into 'all applications' and 'for flexdelft'. @rwbackx
......
......@@ -8,7 +8,7 @@ version = "2.2.5"
val javaVersion = JavaVersion.VERSION_21
val labradoorVersion = "1.6.5"
val labradoorVersion = "1.7.0"
val libradorVersion = "1.4.1"
val chihuahUIVersion = "1.2.4"
val guavaVersion = "32.1.1-jre"
......
......@@ -21,13 +21,12 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import nl.tudelft.labracore.app.LabracoreAppConfig;
import nl.tudelft.labracore.lib.LabracoreApiConfig;
import nl.tudelft.labracore.lib.LabracoreAppConfig;
import nl.tudelft.librador.EnableLibrador;
@EnableLibrador
@Import(LabracoreApiConfig.class)
@Import(LabracoreAppConfig.class)
@Import({ LabracoreApiConfig.class, LabracoreAppConfig.class })
@SpringBootApplication(scanBasePackageClasses = TAMApplication.class)
public class TAMApplication {
public static void main(String[] args) {
......
......@@ -315,7 +315,8 @@ public class JobOfferController {
trainingTypeService.getAllTrainingTypesForPrograms(List.of(programId)));
Map<Long, Double> result = personService
.getQueueFeedbacks(applications.stream().map(ApplicationSummaryDTO::getPersonId).toList());
.getQueueFeedbacks(applications.stream().map(ApplicationSummaryDTO::getPersonId).toList())
.orElse(null);
model.addAttribute("queueFeedbacks", result);
return "job_offer/view_one";
}
......
......@@ -25,19 +25,18 @@ import java.util.stream.Stream;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import nl.tudelft.labracore.lib.service.AppConnectionService;
import lombok.NonNull;
import nl.tudelft.labracore.api.PersonControllerApi;
import nl.tudelft.labracore.api.dto.PersonDetailsDTO;
import nl.tudelft.labracore.api.dto.PersonSummaryDTO;
import nl.tudelft.labracore.api.dto.RoleEditionDetailsDTO;
import nl.tudelft.labracore.app.service.AppConnectionService;
import nl.tudelft.tam.cache.PersonCacheManager;
import nl.tudelft.tam.model.Profile;
......@@ -56,14 +55,9 @@ public class PersonService {
@Autowired
AppConnectionService appConnectionService;
private RestTemplate restTemplate = new RestTemplate();
@Autowired
ModelMapper mapper;
@Value("${tam.queue-url}")
private String queueURL;
/**
* Gets the roles for a person
*
......@@ -164,22 +158,17 @@ public class PersonService {
* @param ids The ids of the persons
* @return The average star ratings
*/
public Map<Long, Double> getQueueFeedbacks(List<Long> ids) {
RestTemplate restTemplate = appConnectionService.connect(queueURL);
return restTemplate.exchange(
queueURL + "/average-star-rating?ids={ids}",
public Optional<Map<Long, Double>> getQueueFeedbacks(List<Long> ids) {
RestTemplate restTemplate = appConnectionService.connect("queue");
if (restTemplate == null) {
return Optional.empty();
}
return Optional.ofNullable(restTemplate.exchange("/api/average-star-rating?ids={ids}",
HttpMethod.GET,
null,
new ParameterizedTypeReference<Map<Long, Double>>() {},
ids.toArray()
).getBody();
// return WebClient.create(queueURL)
// .get()
// .uri(builder -> builder.path("/average-star-rating").queryParam("ids", ids.toArray()).build())
// .retrieve()
// .bodyToMono(new ParameterizedTypeReference<Map<Long, Double>>() {
// })
// .block();
new ParameterizedTypeReference<Map<Long, Double>>() {
},
ids.toArray()).getBody());
}
/**
......
......@@ -82,6 +82,9 @@ server:
port: 8085
labrador:
api:
url: https://ta.ewi.tudelft.nl
name: tam
core:
url: http://localhost:8082
apiKey: cc060386-8a24-40ab-8008-31eace667a04
......
......@@ -734,7 +734,7 @@
class="link"
target="_blank"
th:aria-label="#{jobOffer.queueFeedback.view}"
th:text="${queueFeedbacks[app.personId]}"
th:text="${queueFeedbacks != null} ? ${queueFeedbacks[app.personId]} : #{jobOffer.queueFeedback.view}"
th:href="|${@environment.getProperty('tam.queue-url')}/feedback/${app.personId}|"></a>
</td>
<td>
......
......@@ -78,8 +78,8 @@
class="link"
target="_blank"
th:aria-label="#{jobOffer.queueFeedback.view}"
th:text="${queueFeedbacks[app.personId]}"
th:href="|${@environment.getProperty('tam.queue-url')}/feedback/${person.id}|"></a>
th:text="${queueFeedbacks != null} ? ${queueFeedbacks[person.getKey().id]} : #{jobOffer.queueFeedback.view}"
th:href="|${@environment.getProperty('tam.queue-url')}/feedback/${person.getKey().id}|"></a>
</td>
</tr>
</table>
......
......@@ -483,7 +483,7 @@ class JobOfferControllerTest {
.thenReturn(List.of(ap1, ap2));
when(courseService.getCourseById(anyLong())).thenReturn(new CourseDetailsDTO().program(new ProgramSummaryDTO().id(1L)));
Map<Long, Double> queueFeedbacks = Map.ofEntries(Map.entry(PERSON_ID_1, 3.2),Map.entry(PERSON_ID_2, 4.7));
when(personService.getQueueFeedbacks(anyList())).thenReturn(queueFeedbacks);
when(personService.getQueueFeedbacks(anyList())).thenReturn(Optional.of(queueFeedbacks));
int[] stats = { 2, 1, 0 };
......@@ -496,7 +496,7 @@ class JobOfferControllerTest {
.andExpect(model().attribute("deadlineClosed", false))
.andExpect(model().attribute("applications", List.of(ap1, ap2)))
.andExpect(model().attribute("stats", stats))
.andExpect(model().attribute("anyoneTookCourseBefore", true));
.andExpect(model().attribute("anyoneTookCourseBefore", true))
.andExpect(model().attribute("queueFeedbacks", queueFeedbacks));
verify(offerService).getById(JOFFER_ID_1);
......
......@@ -31,7 +31,7 @@ tam:
cache:
person-timeout: 60
study-progress-link: https://my.tudelft.nl/#/voortgang/:id
queue-url: http://localhost:8081
queue-url: localhost:8081
spring:
main:
......@@ -74,6 +74,9 @@ server:
port: 8085
labrador:
api:
url: http://localhost:8085
name: tam
core:
url: http://localhost:8082
apiKey: cc060386-8a24-40ab-8008-31eace667a04
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment