Skip to content

Commit

Permalink
fix: hole join floor ambiguous column name
Browse files Browse the repository at this point in the history
  • Loading branch information
JingYiJun committed Apr 5, 2024
1 parent 2c279f5 commit 12ea068
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
8 changes: 4 additions & 4 deletions apis/hole/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func ListHolesByDivision(c *fiber.Ctx) error {
return err
}
if id != 0 {
querySet = querySet.Where("division_id = ?", id)
querySet = querySet.Where("hole.division_id = ?", id)
}
querySet.Find(&holes)

Expand Down Expand Up @@ -121,7 +121,7 @@ func ListHolesByMe(c *fiber.Ctx) error {
if err != nil {
return err
}
querySet = querySet.Where("user_id = ?", userID)
querySet = querySet.Where("hole.user_id = ?", userID)
querySet.Find(&holes)

return Serialize(c, &holes)
Expand Down Expand Up @@ -152,7 +152,7 @@ func ListGoodHoles(c *fiber.Ctx) error {
if err != nil {
return err
}
querySet = querySet.Where("good = 1")
querySet = querySet.Where("hole.good = 1")
err = querySet.Find(&holes).Error
if err != nil {
return err
Expand Down Expand Up @@ -194,7 +194,7 @@ func ListHolesOld(c *fiber.Ctx) error {
}
} else if query.DivisionID != 0 {
querySet.
Where("division_id = ?", query.DivisionID).
Where("hole.division_id = ?", query.DivisionID).
Find(&holes)
} else {
querySet.Find(&holes)
Expand Down
10 changes: 5 additions & 5 deletions models/hole.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,15 +310,15 @@ func (holes Holes) MakeQuerySet(offset common.CustomTime, size int, order string
if err != nil {
return nil, err
}
querySet.Where("hidden = ?", false)
querySet.Where("hole.hidden = ?", false)
if order == "time_created" || order == "created_at" {
return querySet.
Where("created_at < ?", offset.Time).
Order("created_at desc").Limit(size), nil
Where("hole.created_at < ?", offset.Time).
Order("hole.created_at desc").Limit(size), nil
} else {
return querySet.
Where("updated_at < ?", offset.Time).
Order("updated_at desc").Limit(size), nil
Where("hole.updated_at < ?", offset.Time).
Order("hole.updated_at desc").Limit(size), nil
}
}

Expand Down

0 comments on commit 12ea068

Please sign in to comment.