Skip to content

Commit

Permalink
Merge pull request #68 from moevm/back-fix-12
Browse files Browse the repository at this point in the history
corrected imports
  • Loading branch information
AnjeZenda authored Dec 11, 2024
2 parents be9e4ca + 24ca84b commit 35f1ef0
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions server/internal/storage/plants.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package storage
import (
"context"
"time"
"fmt"

"plants/internal/models"

Expand Down Expand Up @@ -159,21 +158,21 @@ func (s *Storage) GetPlantsForTrade(ctx context.Context, id string) ([]*models.P
return nil, err
}
filter := bson.D{
{Key: "$and", Value: bson.A{
bson.D{
{Key: "$or", Value: bson.A{
bson.D{{Key: "offerer.plant._id", Value: plant.ID}},
bson.D{{Key: "accepter.plant._id", Value: plant.ID}},
}},
},
bson.D{
{Key: "$or", Value: bson.A{
bson.D{{Key: "status", Value: 1}},
bson.D{{Key: "status", Value: 2}},
}},
},
}},
}
{Key: "$and", Value: bson.A{
bson.D{
{Key: "$or", Value: bson.A{
bson.D{{Key: "offerer.plant._id", Value: plant.ID}},
bson.D{{Key: "accepter.plant._id", Value: plant.ID}},
}},
},
bson.D{
{Key: "$or", Value: bson.A{
bson.D{{Key: "status", Value: 1}},
bson.D{{Key: "status", Value: 2}},
}},
},
}},
}
var tmpTrade models.Trade
if err = collectionTrades.FindOne(ctx, filter).Decode(&tmpTrade); err != nil {
plants = append(plants, &plant)
Expand Down

0 comments on commit 35f1ef0

Please sign in to comment.