Skip to content
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

Stage 5 and above error + Python implementation #1

Open
tiaanv opened this issue Dec 14, 2020 · 1 comment
Open

Stage 5 and above error + Python implementation #1

tiaanv opened this issue Dec 14, 2020 · 1 comment

Comments

@tiaanv
Copy link

tiaanv commented Dec 14, 2020

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

@Quantiversal
Copy link
Owner

Hey, sorry for the very late reply. I wasn't watching my own repo haha.

I see that inside _getAreaCodeAccumulationDayStart, there's also a statement checking stage 4. I can't remember what that's about (I forget old code easily) so not sure I'll get around to maintaining this repo currently (anyone is welcome to fork).
I'm quite busy I'm afraid and have moved to an area that can't use these tables - Eskom supplied 😔 .

I probably didn't test > stage 4 much as I was hoping we wouldn't need them, but wrong data is worse than no data, so I'm sorry if that cause a headache.

I'm glad you found the solution though and it's good that it can serve as a starting point in your own project at least. That's why I even bothered to put it in a repo 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants