GithubHelp home page GithubHelp logo

quantiversal / cape-town-loadshedding-schedule Goto Github PK

View Code? Open in Web Editor NEW
14.0 14.0 1.0 17 KB

A class that can be used to fetch loadshedding times based on stages 1-8

License: MIT License

Java 49.66% HTML 16.23% JavaScript 34.11%
cape-town loadshedding

cape-town-loadshedding-schedule's Issues

OK so not an issue but I can't fathom out how to message you :(

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!

Stage 5 and above error + Python implementation

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.