Skip to content

Commit

Permalink
fixed having a wrong arguent in the OldestDateAt query
Browse files Browse the repository at this point in the history
  • Loading branch information
CommanderStorm committed Oct 10, 2023
1 parent a83bad3 commit c947adc
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/backend/movie.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func (s *CampusServer) ListMovies(ctx context.Context, req *pb.ListMoviesRequest
var movies []model.Kino
tx := s.db.WithContext(ctx).Joins("File")
if req.OldestDateAt.GetSeconds() != 0 || req.OldestDateAt.GetNanos() != 0 {
tx = tx.Where("src > ?", req.OldestDateAt)
tx = tx.Where("date > ?", req.OldestDateAt.AsTime())
}
if err := tx.Find(&movies, "kino > ?", req.LastId).Error; err != nil {
log.WithError(err).Error("Error while fetching movies from database")
Expand Down
2 changes: 1 addition & 1 deletion server/backend/news.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (s *CampusServer) ListNews(ctx context.Context, req *pb.ListNewsRequest) (*
tx = tx.Where("src = ?", req.NewsSource)
}
if req.OldestDateAt.GetSeconds() != 0 || req.OldestDateAt.GetNanos() != 0 {
tx = tx.Where("src > ?", req.OldestDateAt)
tx = tx.Where("date > ?", req.OldestDateAt.AsTime())
}
if req.LastNewsId != 0 {
tx = tx.Where("news > ?", req.LastNewsId)
Expand Down

0 comments on commit c947adc

Please sign in to comment.