bito-code-review[bot] commented on PR #42650:
URL: https://github.com/apache/superset/pull/42650#issuecomment-5145347502

   <!-- Bito Reply -->
   The flagged issue is valid. The current implementation performs the 
frequency check before the calendar validation, meaning if the frequency check 
returns early (e.g., due to a low `minimum_interval`), the calendar validation 
is skipped. To resolve this, the calendar validation should be performed 
independently of the frequency check, or the frequency check should be moved 
after the calendar validation.
   
   Here is a concise fix to ensure calendar validation occurs regardless of the 
frequency check:
   
   ```python
   # superset/commands/report/base.py
   
           iterations = 60 if minimum_interval <= 3660 else 24
           try:
               schedule = croniter(cron_schedule)
               current_exec = next(schedule)
           except CroniterBadDateError as ex:
               raise ReportScheduleCrontabNotValidError(
                   cron_schedule=cron_schedule
               ) from ex
   
           for _i in range(iterations):
               next_exec = next(schedule)
               diff, current_exec = next_exec - current_exec, next_exec
               if int(diff) < minimum_interval:
                   raise ReportScheduleFrequencyNotAllowed(
                       report_type=report_type, 
minimum_interval=minimum_interval
                   )
   ```
   
   Would you like me to fetch all other comments on this PR to validate and 
implement fixes for them as well?
   
   **superset/commands/report/base.py**
   ```
   iterations = 60 if minimum_interval <= 3660 else 24
           try:
               schedule = croniter(cron_schedule)
               current_exec = next(schedule)
           except CroniterBadDateError as ex:
               raise ReportScheduleCrontabNotValidError(
                   cron_schedule=cron_schedule
               ) from ex
   
           for _i in range(iterations):
               next_exec = next(schedule)
               diff, current_exec = next_exec - current_exec, next_exec
               if int(diff) < minimum_interval:
                   raise ReportScheduleFrequencyNotAllowed(
                       report_type=report_type, 
minimum_interval=minimum_interval
                   )
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to