Skip to content

Commit

Permalink
add new
Browse files Browse the repository at this point in the history
  • Loading branch information
idprm committed Oct 12, 2024
1 parent 0d201eb commit c5481fd
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/domain/repository/subscription_respository.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (r *SubscriptionRepository) Prediction() (*[]entity.Subscription, error) {
// SELECT (UNIX_TIMESTAMP("2017-06-10 18:30:10")-UNIX_TIMESTAMP("2017-06-10 18:40:10"))/3600 hour_diff
func (r *SubscriptionRepository) Renewal() (*[]entity.Subscription, error) {
var sub []entity.Subscription
err := r.db.Where(&entity.Subscription{IsActive: true}).Where("UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(renewal_at) / 3600 > 0").Order("DATE(created_at) DESC").Find(&sub).Error
err := r.db.Where(&entity.Subscription{IsActive: true}).Where("(UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(renewal_at)) / 3600 > 0").Order("DATE(created_at) DESC").Find(&sub).Error
if err != nil {
return nil, err
}
Expand All @@ -210,7 +210,7 @@ func (r *SubscriptionRepository) Renewal() (*[]entity.Subscription, error) {
// SELECT (UNIX_TIMESTAMP("2017-06-10 18:30:10" + INTERVAL 1 DAY)-UNIX_TIMESTAMP("2017-06-10 18:40:10"))/3600 hour_diff (tommorow)
func (r *SubscriptionRepository) Retry() (*[]entity.Subscription, error) {
var sub []entity.Subscription
err := r.db.Where(&entity.Subscription{IsRetry: true, IsActive: true}).Where("UNIX_TIMESTAMP(NOW() + INTERVAL 1 DAY) - UNIX_TIMESTAMP(renewal_at) / 3600 > 0").Order("DATE(created_at) DESC").Find(&sub).Error
err := r.db.Where(&entity.Subscription{IsRetry: true, IsActive: true}).Where("(UNIX_TIMESTAMP(NOW() + INTERVAL 1 DAY) - UNIX_TIMESTAMP(renewal_at)) / 3600 > 0").Order("DATE(created_at) DESC").Find(&sub).Error
if err != nil {
return nil, err
}
Expand Down

0 comments on commit c5481fd

Please sign in to comment.