Skip to content

Commit

Permalink
add new
Browse files Browse the repository at this point in the history
  • Loading branch information
idprm committed Oct 19, 2024
1 parent 6a8a908 commit 814c6a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cmd/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,11 +389,11 @@ var publisherScrapingPredictionCmd = &cobra.Command{
scheduleRepo := repository.NewScheduleRepository(db)
scheduleService := services.NewScheduleService(scheduleRepo)

if scheduleService.IsUnlocked(ACT_SCRAPING, timeNow) {
if scheduleService.IsUnlocked(ACT_PREDICTION, timeNow) {

scheduleService.UpdateLocked(
&entity.Schedule{
Name: ACT_SCRAPING,
Name: ACT_PREDICTION,
},
)

Expand All @@ -402,10 +402,10 @@ var publisherScrapingPredictionCmd = &cobra.Command{
}()
}

if scheduleService.IsUnlocked(ACT_SCRAPING, timeNow) {
if scheduleService.IsUnlocked(ACT_PREDICTION, timeNow) {
scheduleService.Update(
&entity.Schedule{
Name: ACT_SCRAPING,
Name: ACT_PREDICTION,
IsUnlocked: true,
},
)
Expand Down
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const (
ACT_SUB string = "SUB"
ACT_UNSUB string = "UNSUB"
ACT_USER_LOSES string = "USER_LOSES"
ACT_PREDICTION string = "PREDICTION"
ACT_SCRAPING string = "SCRAPING"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/domain/repository/schedule_repository.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (r *ScheduleRepository) Update(c *entity.Schedule) error {
}

func (r *ScheduleRepository) UpdateLocked(c *entity.Schedule) error {
err := r.db.Where("name = ?", c.Name).Update("is_unlocked", false).Error
err := r.db.Model(c).Where("name = ?", c.Name).Update("is_unlocked", false).Error
if err != nil {
return err
}
Expand Down

0 comments on commit 814c6a8

Please sign in to comment.