Skip to content

Commit

Permalink
output explicit satellite name
Browse files Browse the repository at this point in the history
sometimes TLE has temporary satellite name and explicit name is to
provided separately.
  • Loading branch information
dernasherbrezon committed Aug 2, 2024
1 parent 4015806 commit b756e90
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ public ModelAndView doGet(IHTTPSession session) {
LOG.info("not found: {} id: {}", satelliteId, id);
return new NotFound();
}
Satellite satellite = satelliteDao.findById(entity.getSatelliteId());
if (satellite == null) {
LOG.info("satellite not found: {}", entity.getSatelliteId());
return new NotFound();
}
JsonObject json = entity.toJson(signed);
json.add("satelliteName", satellite.getName());
if (entity.getDataPath() != null) {
JsonArray beacons = convertBeacons(entity);
JsonArray beacons = convertBeacons(satellite, entity);
if (beacons != null) {
json.add("dataEntity", beacons);
}
Expand All @@ -76,11 +82,7 @@ public ModelAndView doGet(IHTTPSession session) {
return result;
}

private JsonArray convertBeacons(Observation entity) {
Satellite satellite = satelliteDao.findById(entity.getSatelliteId());
if (satellite == null) {
return null;
}
private static JsonArray convertBeacons(Satellite satellite, Observation entity) {
Transmitter transmitter = satellite.getById(entity.getTransmitterId());
if (transmitter == null) {
return null;
Expand Down
1 change: 1 addition & 0 deletions src/test/resources/aausat4Observation/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"id": "1559942730784",
"start": 1559942730839,
"end": 1559942731040,
"satelliteName": "AAUSAT 4",
"satellite": "41460",
"transmitterId": "41460-0",
"tle": {
Expand Down

0 comments on commit b756e90

Please sign in to comment.