Skip to content

Commit

Permalink
Updated results
Browse files Browse the repository at this point in the history
  • Loading branch information
eluchsinger committed May 1, 2018
1 parent cdf5668 commit 4cea5af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/controllers/MeasurementsController.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ public Result stopMeasurement() {

public Result getActiveMeasurement() {
if(this.activeMeasurement != null){
return Results.ok(Json.toJson(this.activeMeasurement));
final MeasurementReadings activeMeasurement = this.measurementsRepository
.getMeasurementReadingsById(this.activeMeasurement.getMeasurementId());
return Results.ok(Json.toJson(activeMeasurement));
}
return Results.noContent();
}
Expand All @@ -115,7 +117,7 @@ public Result getActiveMeasurement() {
public CompletableFuture<Result> addReading() {
return CompletableFuture.supplyAsync(() -> {
if(this.activeMeasurement == null) {
return Results.badRequest("No active measurement");
return Results.noContent();
}
try {
final JsonNode json = request().body().asJson();
Expand Down
4 changes: 2 additions & 2 deletions conf/routes
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ POST /measurements controllers.MeasurementsController.c
PUT /measurements/active/:measurementId controllers.MeasurementsController.startMeasurement(measurementId : String)
DELETE /measurements/active controllers.MeasurementsController.stopMeasurement
POST /measurements/active/readings controllers.MeasurementsController.addReading
GET /streamMeasurements controllers.MeasurementsController.streamMeasurements
GET /streamMeasurements controllers.MeasurementsController.streamMeasurements

# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)
GET /assets/*file controllers.Assets.versioned(path="/public", file: Asset)

0 comments on commit 4cea5af

Please sign in to comment.