New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add quick action to check whether the CS building is open #112
Comments
Matt you do not need an API for this. var currentTime = new Date();
var currentHour = currentTime.getHours();
var currentDay = currentTime.getDay();
var isOpen = false;
if (studentType === 'non-taught' || (studentType === 'taught' && (currentHour >= 9 && currentHour < 23 && currentDay >= 1 && currentDay <= 5) || (currentHour >= 9 && currentHour < 17 && (currentDay === 0 || currentDay === 6)))) {
isOpen = true
} |
Whilst I agree here, I'd recommend the removal of magic numbers + the consolidation of these conditionals to constants that are defined outside of the main conditional for clarity. i.e: |
Admittedly the solution is not very complex, however I do not want to have to deal with updating the rules for edge-cases & holidays, especially when an existing solution exists (https://iscsopen.com), which is actively maintained by someone else |
No offence to Dak, but I highly doubt that iscsopen is going to be accurate long-term. |
However, I expect |
Any version of this isn't going to be accurate long term. |
Agreed. Therefore I would be more willing to rely on a developer, whose sole focus is ensuring the opening-times accuracy, rather than a developer that has many other issues to deal with (🥲). |
Using either webscraping or the API (if it gets developed) of https://iscsopen.com TeXBot should provide information on whether the CS building is open.
A credits message should also be added to mention that the information is retrieved from https://iscsopen.com.
Suggestions/reasons on whether or not to include this feature are welcomed.
The text was updated successfully, but these errors were encountered: