@@ -28,6 +28,12 @@ export class FixValidatedLiveAlertCertificationChallengeIds extends Script {
28
28
demandOption : false ,
29
29
default : 100 ,
30
30
} ,
31
+ startingFromDate : {
32
+ type : 'date' ,
33
+ describe : 'allows to run the script only for certification-courses that happened after the given date' ,
34
+ demandOption : true ,
35
+ default : new Date ( 2024 , 10 , 4 ) ,
36
+ } ,
31
37
} ,
32
38
} ) ;
33
39
@@ -39,7 +45,9 @@ export class FixValidatedLiveAlertCertificationChallengeIds extends Script {
39
45
const dryRun = options . dryRun ;
40
46
const batchSize = options . batchSize ;
41
47
const delayInMs = options . delayBetweenBatch ;
42
- this . logger . info ( `dryRun=${ dryRun } ` ) ;
48
+ const startingFromDate = options . startingFromDate ;
49
+
50
+ this . logger . info ( { dryRun, batchSize, delayInMs, startingFromDate } ) ;
43
51
44
52
let hasNext = true ;
45
53
let cursorId = 0 ;
@@ -50,6 +58,7 @@ export class FixValidatedLiveAlertCertificationChallengeIds extends Script {
50
58
const courseIds = await this . #getCourseIds( {
51
59
cursorId,
52
60
batchSize,
61
+ startingFromDate,
53
62
transaction,
54
63
} ) ;
55
64
@@ -173,12 +182,14 @@ export class FixValidatedLiveAlertCertificationChallengeIds extends Script {
173
182
} ;
174
183
}
175
184
176
- #getCourseIds( { cursorId, batchSize, transaction } ) {
185
+ #getCourseIds( { cursorId, batchSize, startingFromDate, transaction } ) {
186
+ this . logger . debug ( { cursorId, batchSize, startingFromDate } ) ;
177
187
return transaction
178
188
. select ( 'id' )
179
189
. from ( 'certification-courses' )
180
190
. where ( 'certification-courses.id' , '>' , cursorId )
181
191
. andWhere ( 'certification-courses.version' , '=' , AlgorithmEngineVersion . V3 )
192
+ . andWhere ( 'certification-courses.createdAt' , '>' , startingFromDate )
182
193
. orderBy ( 'certification-courses.id' )
183
194
. limit ( batchSize ) ;
184
195
}
0 commit comments