-
-
Notifications
You must be signed in to change notification settings - Fork 558
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
Better interval computation for Long-term data -> Graphics page #2132
Conversation
Thanks @rdwebdesign! I've updated as per comments. Did not take 5hrs since it does not "slot" well into 24hrs. I've also rebased to latest devel. |
pi-hole/AdminLTE repo uses Prettier to verify code format. Break this long array declaration: const intervals = [
10,
20,
30,
60,
120,
180,
300,
600,
900,
1200,
1800,
3600,
3600 * 2,
3600 * 3,
3600 * 4,
3600 * 6,
3600 * 8,
3600 * 12,
3600 * 24,
3600 * 24 * 7,
3600 * 24 * 30,
]; And remove unnecessary parentheses: var err = Math.abs(1 - duration / (num * intervals[i]));
// pick the interval with least deviation |
Done! Did not rebase this time. Hope that's ok. |
Hopefully it's fine now! :) |
The test returned "Error - Parsing error: Unexpected token i". |
I think For now, try remove |
I did a few tests. I replaced
|
Where can I find the eslint configuration so that I can try locally? |
The tests are configured in https://github.com/pi-hole/AdminLTE/blob/master/package.json You just need to run
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not use for...in
with array iteration.
https://stackoverflow.com/questions/500504/why-is-using-for-in-for-array-iteration-a-bad-idea
Use something simple like for (i=0; i<intervals.length; i++) {
Signed-off-by: rubpa <rubpa@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/pi-hole-ftl-v5-15-web-v5-12-and-core-v5-10-released/54987/1 |
Signed-off-by: rubpa rubpa@users.noreply.github.com
By submitting this pull request, I confirm the following:
git rebase
)git commit --signoff
)What does this PR aim to accomplish?:
The Long-term data -> Graphics page showed graphs with very "unrounded" intervals as in the screenshots below.
API call for above was: admin/api_db.php?getGraphData&from=1645209000&until=1645276215.962&interval=336.07980999946597
API call for above was: admin/api_db.php?getGraphData&from=1644671415.963&until=1645276215.963&interval=3024
How does this PR accomplish the above?:
This PR tries to still keep approx 200 intervals but by choosing more "rounded" values like 10 mins, 20 mins, 30 mins, 1 hr, etc. based on the selected duration.
What documentation changes (if any) are needed to support this PR?:
Documentation changes are not required.