fix concerts deleting when nothing is scraped
This commit is contained in:
@@ -38,7 +38,11 @@ func (as ConcertService) CheckAndUpdateConcerts(ctx context.Context) []model.Con
|
||||
cm := as.GetAll(ctx)
|
||||
fmt.Printf("Currently there are %d concerts\n", len(*cm))
|
||||
NewConcerts := scrapeData(ctx)
|
||||
fmt.Printf("There are %d new concerts\n", len(*NewConcerts))
|
||||
concertCount := len(*NewConcerts)
|
||||
fmt.Printf("There are %d new concerts\n", concertCount)
|
||||
if concertCount == 0 {
|
||||
return *NewConcerts
|
||||
}
|
||||
forInsert, forDelete, _ := partitionConcerts(*cm, *NewConcerts)
|
||||
|
||||
tx := as.repository.CreateTransaction()
|
||||
|
||||
Reference in New Issue
Block a user