Closed Abbe98 closed 8 years ago
Fixed in back end. Now returns: "comments_count": 3,
In both GET /observations/
Amazing @bjornhjelle I have now implemented this and moved in to "Shipping" on the project board: https://github.com/Biocaching/issues/projects/1?fullscreen=true
@bjornhjelle the following observation has 3 comments but still comments_count
is set to 1
:
{
"_index": "observations",
"_type": "observation",
"_id": "130",
"_score": null,
"_source": {
"id": 130,
"observed_at": "2016-08-08T12:14:00.000+02:00",
"user_id": 3,
"comment": "",
"created_at": "2016-08-08T12:21:53.000+02:00",
"updated_at": "2016-08-08T12:21:53.000+02:00",
"what3words": "animal.brush.routines",
"individual_count": 1,
"sex": "",
"life_stage": "",
"country": "Norway",
"county": "Oslo",
"municipality": "Oslo",
"locality": "Brekke",
"geonames_id": "9404473",
"coordinate_uncertainty_in_meters": null,
"is_public": true,
"location_id": "http://sws.geonames.org/9404473",
"location": {
"lat": "59.96279",
"lon": "10.755615"
},
"tags": [
],
"tags_suggest": {
"input": [
]
},
"verified_by": null,
"points": 1,
"comments_count": 1,
"taxon": {
"id": 70852,
"scientific_name": "pica pica",
"all_common_names": {
"eng": [
"Black-billed Magpie"
],
"fra": [
"pie bavarde"
],
"nob": [
"skjære"
],
"nno": [
"skjor"
],
"ces": [
"straka obecná"
]
}
},
"likes": [
],
"other_pictures": [
]
},
"sort": [
1470651713000
]
},
Should now be fixed so that adding or removing comments triggers a re-indexing of the observation in Elasticsearch. When getting a single observation the count is correct, since the observation is then fetched from the database, not from Elasticsearch.
@bjornhjelle this requires that the comment count is returned by
observations/<id>
.