make distance stuff greate again
This commit is contained in:
@@ -116,14 +116,20 @@ func (s MongoDBStorage) GetUserRegularRoutes(userid string) ([]*geojson.FeatureC
|
||||
}
|
||||
|
||||
func (s MongoDBStorage) GetDriverRegularRoutesForTile(day string, gridId int64) ([]*geojson.FeatureCollection, error) {
|
||||
log.Debug().
|
||||
Str("day", day).
|
||||
Int64("grid id", gridId).
|
||||
Msg("GetDriverRegularRoutesForTile")
|
||||
|
||||
findOptions := options.Find()
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["regular_routes"])
|
||||
cur, err := collection.Find(context.TODO(), bson.M{
|
||||
"properties.schedule.day": day,
|
||||
"grid_ids": gridId,
|
||||
"properties.is_driver": true,
|
||||
"properties.schedules.day": day,
|
||||
"grid_ids": gridId,
|
||||
"properties.is_driver": true,
|
||||
}, findOptions)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("GetDriverRegularRoutesForTile - mongodb issue")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -132,12 +138,14 @@ func (s MongoDBStorage) GetDriverRegularRoutesForTile(day string, gridId int64)
|
||||
var elem bson.M
|
||||
|
||||
if err := cur.Decode(&elem); err != nil {
|
||||
log.Error().Err(err).Msg("GetDriverRegularRoutesForTile - decode error")
|
||||
return nil, err
|
||||
}
|
||||
bsonBytes, _ := bson.Marshal(elem)
|
||||
fc := geojson.NewFeatureCollection()
|
||||
err := fc.UnmarshalBSON(bsonBytes)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("GetDriverRegularRoutesForTile - unmarshalling error")
|
||||
return nil, err
|
||||
}
|
||||
fc.ExtraMembers["id"] = fc.ExtraMembers.MustString("_id")
|
||||
@@ -162,9 +170,9 @@ func (s MongoDBStorage) GetPassengerRegularRoutesForTile(day string, gridId int6
|
||||
findOptions := options.Find()
|
||||
collection := s.Client.Database(s.DbName).Collection(s.Collections["regular_routes"])
|
||||
cur, err := collection.Find(context.TODO(), bson.M{
|
||||
"properties.schedule.day": day,
|
||||
"grid_ids": gridId,
|
||||
"properties.is_passenger": true,
|
||||
"properties.schedules.day": day,
|
||||
"grid_ids": gridId,
|
||||
"properties.is_passenger": true,
|
||||
}, findOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user