WildAid / o-fish-ios

iOS app for the Officer's Fishery Information Sharing Hub (O-FISH). The mobile app allows fisheries officers to document and share critical information gathered during a routine vessel inspection.
Apache License 2.0
33 stars 15 forks source link

Previous 5 boardings not sorted properly #163

Closed o-fish-wildaid closed 4 years ago

o-fish-wildaid commented 4 years ago

When I look at the recent boardings I can see the following vessels: Orca - Magic - Location Test - TestVessel - Jenny. But in the database the most recent boardings are Orca - Predator - Magic - Location Test - TestVessel.

Sheeri commented 4 years ago

What I see on the screen (ios is the same even though this is an android screenshot): Screenshot_1595957032

From the database (the query limits the timestamp so there aren't ALL the records shown): MongoDB Enterprise atlas-l4abbo-shard-0:PRIMARY> db.BoardingReports.aggregate([{$match: { agency:'Ecuadorian Galapagos', timestamp: {$gt : ISODate("2020-07-25 00:00:00.000Z")} }}, {$sort: { timestamp: -1 }}, {$project: { 'vessel.name': 1, timestamp: 1, _id: 0 }}]); { "timestamp" : ISODate("2020-07-28T17:17:43.407Z"), "vessel" : { "name" : "Orca" } } { "timestamp" : ISODate("2020-07-28T17:16:56.318Z"), "vessel" : { "name" : "Predator" } } { "timestamp" : ISODate("2020-07-28T17:16:22.183Z"), "vessel" : { "name" : "Magic" } } { "timestamp" : ISODate("2020-07-28T16:55:34.351Z"), "vessel" : { "name" : "Location Test" } } { "timestamp" : ISODate("2020-07-28T16:21:17.338Z"), "vessel" : { "name" : "Location Test" } } { "timestamp" : ISODate("2020-07-28T16:19:35.063Z"), "vessel" : { "name" : "Location Test" } } { "timestamp" : ISODate("2020-07-28T14:11:02.583Z"), "vessel" : { "name" : "Location Test" } } { "timestamp" : ISODate("2020-07-28T09:04:12.183Z"), "vessel" : { "name" : "TestVessel" } } { "timestamp" : ISODate("2020-07-27T14:27:32.455Z"), "vessel" : { "name" : "Jenny" } } { "timestamp" : ISODate("2020-07-27T14:23:28.354Z"), "vessel" : { "name" : "Jenny" } } { "timestamp" : ISODate("2020-07-27T12:21:27.275Z"), "vessel" : { "name" : "Location Test" } } { "timestamp" : ISODate("2020-07-27T12:20:05.059Z"), "vessel" : { "name" : "Location Test" } } { "timestamp" : ISODate("2020-07-27T12:03:34.775Z"), "vessel" : { "name" : "Jenny" } } { "timestamp" : ISODate("2020-07-27T11:43:04.691Z"), "vessel" : { "name" : "Jenny" } }

akaktus commented 4 years ago

@Sheeri it happens, because "Orca" and "Predator" both don't have permit number (or have the same - empty).

Sheeri commented 4 years ago

Bob from WildAid says. "Most records will have permit number, but we should not hide records without them."

Please show boardings with permit numbers. It is OK if boardings with the same vessel name and blank permit number (e.g. "test" and blank permit number) are grouped as the same vessel.

akaktus commented 4 years ago

@Sheeri, for now it works in the same way. If vessel has permit number, we use permit number as unique identifier and group vessels by permit number. If vessel don't have permit number, we use name of the vessel as a unique identifier and group this vessel by name. Simulator Screen Shot - iPhone 11 - 2020-08-05 at 17 02 49

Sheeri commented 4 years ago

Confirmed this works as you say. Closing!