Skip to content

Commit

Permalink
add more modifiable fields when editting/transitioning queue entries (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
chibongho authored Mar 8, 2024
1 parent 7beef8c commit be7cc0c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ public class QueueEntryTransition implements Serializable {

private Concept newPriority;

private String newPriorityComment;

/**
* @return a new queue entry representing what one intends to transition into
*/
Expand All @@ -43,7 +45,8 @@ public QueueEntry constructNewQueueEntry() {
queueEntry.setPatient(queueEntryToTransition.getPatient());
queueEntry.setVisit(queueEntryToTransition.getVisit());
queueEntry.setPriority(newPriority == null ? queueEntryToTransition.getPriority() : newPriority);
queueEntry.setPriorityComment(queueEntryToTransition.getPriorityComment());
queueEntry.setPriorityComment(
newPriorityComment == null ? queueEntryToTransition.getPriorityComment() : newPriorityComment);
queueEntry.setStatus(newStatus == null ? queueEntryToTransition.getStatus() : newStatus);
queueEntry.setSortWeight(queueEntryToTransition.getSortWeight());
queueEntry.setLocationWaitingFor(queueEntryToTransition.getLocationWaitingFor());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ public void shouldTransitionQueueEntry() {
Concept concept1 = new Concept();
Concept concept2 = new Concept();
String string1 = "starting";
String string2 = "some string";
double double1 = 5.0;
Location location1 = new Location();
Provider provider1 = new Provider();
Expand Down Expand Up @@ -265,14 +266,15 @@ public void shouldTransitionQueueEntry() {
transition2.setTransitionDate(date3);
transition2.setNewQueue(queue2);
transition2.setNewPriority(concept2);
transition2.setNewPriorityComment(string2);
transition2.setNewStatus(concept2);
QueueEntry queueEntry3 = queueEntryService.transitionQueueEntry(transition2);
assertThat(queueEntry2.getEndedAt(), equalTo(date3));
assertThat(queueEntry3.getQueue(), equalTo(queue2));
assertThat(queueEntry3.getPatient(), equalTo(patient1));
assertThat(queueEntry3.getVisit(), equalTo(visit1));
assertThat(queueEntry3.getPriority(), equalTo(concept2));
assertThat(queueEntry3.getPriorityComment(), equalTo(string1));
assertThat(queueEntry3.getPriorityComment(), equalTo(string2));
assertThat(queueEntry3.getStatus(), equalTo(concept2));
assertThat(queueEntry3.getSortWeight(), equalTo(double1));
assertThat(queueEntry3.getLocationWaitingFor(), equalTo(location1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ public class QueueEntryTransitionRestController extends BaseRestController {

public static final String NEW_PRIORITY = "newPriority";

public static final String NEW_PRIORITY_COMMENT = "newPriorityComment";

private final QueueServicesWrapper services;

@Autowired
Expand Down Expand Up @@ -102,6 +104,8 @@ public Object transitionQueueEntry(@RequestBody Map<String, String> body) {
transition.setNewPriority(concept);
}

transition.setNewPriorityComment(body.get(NEW_PRIORITY_COMMENT));

// Execute transition
QueueEntry newQueueEntry = services.getQueueEntryService().transitionQueueEntry(transition);
return ConversionUtil.convertToRepresentation(newQueueEntry, Representation.REF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,13 @@ public DelegatingResourceDescription getCreatableProperties() throws ResourceDoe
public DelegatingResourceDescription getUpdatableProperties() throws ResourceDoesNotSupportOperationException {
DelegatingResourceDescription description = new DelegatingResourceDescription();
description.addProperty("status");
description.addProperty("priority");
description.addProperty("priorityComment");
description.addProperty("sortWeight");
description.addProperty("startedAt");
description.addProperty("endedAt");
description.addProperty("locationWaitingFor");
description.addProperty("providerWaitingFor");
return description;
}

Expand Down

0 comments on commit be7cc0c

Please sign in to comment.