Call for shows section shown inappropriately #160

Closed
opened 2023-08-27 14:01:19 +00:00 by davmo · 2 comments
Collaborator

The section marked 'Call for shows' on the Home or Index page is displayed when there's no need.

There appears to be an error in the database query which turns this on and off.

The section marked 'Call for shows' on the [Home or Index page](https://hackerpublicradio.org/index.html) is displayed when there's no need. There appears to be an error in the database query which turns this on and off.
davmo added the
Bug Found
label 2023-08-27 14:01:31 +00:00
Author
Collaborator

The algorithm seems to be to look forward 10 days and count the number of shows in that time. If it is less than the minimum possible, then there's a gap within that period and the "Call for shows" message needs to be displayed.

The original algorithm is wrong; the alert message is displayed when there are 25 days to the next free slot!

It's not entirely obvious how many weekdays (Mon-Fri) there are in a random set of 10 days. A small Perl script was written to sample this and the results were:

$ ./count_weekdays
Weekdays between 2023-08-25 and 2023-09-04 = 6
Weekdays between 2023-08-26 and 2023-09-05 = 7
Weekdays between 2023-08-27 and 2023-09-06 = 8
Weekdays between 2023-08-28 and 2023-09-07 = 8
Weekdays between 2023-08-29 and 2023-09-08 = 8
Weekdays between 2023-08-30 and 2023-09-09 = 7
Weekdays between 2023-08-31 and 2023-09-10 = 6
Weekdays between 2023-09-01 and 2023-09-11 = 6
Weekdays between 2023-09-02 and 2023-09-12 = 7
Weekdays between 2023-09-03 and 2023-09-13 = 8
Weekdays between 2023-09-04 and 2023-09-14 = 8

The trigger value in the queries (MySQL and SQLite) needs to be reduced from 7 to 6. Anything below 6 means there is an imminent gap.

A pull request has been generated to correct this.

The algorithm seems to be to look forward 10 days and count the number of shows in that time. If it is less than the minimum possible, then there's a gap within that period and the "Call for shows" message needs to be displayed. The original algorithm is wrong; the alert message is displayed when there are 25 days to the next free slot! It's not entirely obvious how many weekdays (Mon-Fri) there are in a random set of 10 days. A small Perl script was written to sample this and the results were: ``` $ ./count_weekdays Weekdays between 2023-08-25 and 2023-09-04 = 6 Weekdays between 2023-08-26 and 2023-09-05 = 7 Weekdays between 2023-08-27 and 2023-09-06 = 8 Weekdays between 2023-08-28 and 2023-09-07 = 8 Weekdays between 2023-08-29 and 2023-09-08 = 8 Weekdays between 2023-08-30 and 2023-09-09 = 7 Weekdays between 2023-08-31 and 2023-09-10 = 6 Weekdays between 2023-09-01 and 2023-09-11 = 6 Weekdays between 2023-09-02 and 2023-09-12 = 7 Weekdays between 2023-09-03 and 2023-09-13 = 8 Weekdays between 2023-09-04 and 2023-09-14 = 8 ``` The trigger value in the queries (MySQL and SQLite) needs to be reduced from 7 to 6. Anything below 6 means there is an imminent gap. A pull request has been generated to correct this.
Author
Collaborator

Pull request merged.

Closing the issue.

Pull request merged. Closing the issue.
davmo closed this issue 2023-08-27 17:22:13 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: rho_n/hpr_generator#160
No description provided.