quantiversal / cape-town-loadshedding-schedule Goto Github PK
View Code? Open in Web Editor NEWA class that can be used to fetch loadshedding times based on stages 1-8
License: MIT License
A class that can be used to fetch loadshedding times based on stages 1-8
License: MIT License
Not sure if this Repo is still active, but there is a small issue.
When the stage is set to anything greater than 4, then the areas returned is not correct...
This is manifested in a number of functions, but the root of the issue can be attributed to
getAreaCodesByTimeSlot(stage, day, timeSlot)
I'm not sure if my fix for this is appropriate, but after some debugging I simply added the following to the function:
after this line:
let areaCodeAcc = this._getAreaCodeAccumulationDayStart(stage, day) + timeSlot;
added:
if(stage > 4) {
areaCodeAcc ++
}
Technically I did not do this in Java, as my requirement was to have similar functionality in python. Instead, I created a similar set of functions in a Python file. At first I thought I made a mistake in my code, but testing the Javascript rendered the same error.
Please feel free to add it to your repo if you want to. The files are attached.
Thank you for this... Would have taken me days to create the base logic you did, and I HATED the idea of using a lookup table!
loadsheddingschedule-py.zip
Some seriously clever maths in that!
Have you fathomed a way or do you have a source for getting the loadshedding stage for the City of Cape town municipality? They are usually a stage better but that's a bit hit and miss for automation etc.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.