Skip to content

Commit

Permalink
Merge pull request #195 from Viva-con-Agua/stage
Browse files Browse the repository at this point in the history
Stage
  • Loading branch information
deinelieblings authored Jul 10, 2024
2 parents f2eb4c8 + 1bb8294 commit 3fe9593
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions dao/update_ticker.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ func EventStateFinishTicker() {
log.Print(err)
}
if err := EventCollection.UpdateMany(context.Background(), filter.Bson(), vmdb.UpdateSet(update)); err != nil {
log.Print(err)
if !vmdb.ErrNoDocuments(err) {
log.Print(err)
}
}
for _, value := range *events {
filterTaking := bson.D{{Key: "_id", Value: value.TakingID}, {Key: "taking_id", Value: bson.D{{Key: "$ne", Value: ""}}}}
Expand All @@ -68,7 +70,7 @@ func EventStateClosedTicker() {
filter.EqualString("event.event_state.state", "finished")
pipeline := models.TakingPipeline().Match(filter.Bson()).Pipe
takings := []models.Taking{}
if err := TakingCollection.Aggregate(context.Background(), pipeline, takings); err != nil {
if err := TakingCollection.Aggregate(context.Background(), pipeline, &takings); err != nil {
log.Print(err)
}
for i := range takings {
Expand Down
4 changes: 3 additions & 1 deletion dao/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"log"
"pool-backend/models"
"time"

"github.com/Viva-con-Agua/vcapool"

Expand Down Expand Up @@ -38,7 +39,8 @@ func UsersGet(i *models.UserQuery, token *vcapool.AccessToken) (result *[]models
if err = models.UsersPermission(token); err != nil {
return
}
ctx := context.Background()
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
filter := i.PermittedFilter(token)
sort := i.Sort()
opt := options.Aggregate()
Expand Down
2 changes: 1 addition & 1 deletion models/taking.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TakingPipeline() *vmdb.Pipeline {
pipe.Lookup(SourceCollection, "_id", "taking_id", "sources")
pipe.LookupUnwind(CrewCollection, "crew_id", "_id", "crew")
pipe.LookupUnwind(EventCollection, "_id", "taking_id", "event")
pipe.LookupList(ArtistCollection, "artist_ids", "_id", "event.artists")
//pipe.LookupList(ArtistCollection, "event.artist_ids", "_id", "event.artists")
pipe.Append(bson.D{{Key: "$addFields", Value: bson.D{
{Key: "state.wait.amount", Value: bson.D{{Key: "$sum", Value: "$wait.money.amount"}}},
}}})
Expand Down

0 comments on commit 3fe9593

Please sign in to comment.