Giter VIP home page Giter VIP logo

Comments (8)

PromoFaux avatar PromoFaux commented on June 18, 2024

Ah-hah! This explains a few things...

api.php used to just pull the output of chronometer.sh -j (in which the divide by zero error was fixed)

Since the introduction of all the lovely graphs, the calculations were moved into data.php, but it looks like the fix wasn't ported across.. good catch! Thanks

from web.

eko3alpha avatar eko3alpha commented on June 18, 2024

I was actually troubleshooting the panel itself. The charts were spinning and I didn't see any issues in any of the XHR requests. Looking through the php logs I found the error, I fixed it locally on my server...

However the root of the problem was that dnsmasq failed to start when I rebooted my server. Im using Ubuntu and not a pi.

Maybe as a future enhancement have the system make sure all necessary services are running? It would be cool to see an alert warning you that dnsmasq is not running.

I just installed this a few days ago and have yet to play with it. So far I'm pretty impressed! Great work!

from web.

PromoFaux avatar PromoFaux commented on June 18, 2024

Ah, yeah the Ubuntu thing is a known issue link 1 link 2

There is a workaround in the above two links, but it's something we're looking into!

from web.

AzureMarker avatar AzureMarker commented on June 18, 2024

Can you make a pull request with your fix, or just post it here and we'll look at it?

from web.

PromoFaux avatar PromoFaux commented on June 18, 2024

This should do it, right?

        if ($dns_queries_today != 0) {
                    $ads_percentage_today = $ads_blocked_today / $dns_queries_today * 100;  
                }
                else {
                    $ads_percentage_today = 0;
                };

from web.

eko3alpha avatar eko3alpha commented on June 18, 2024

There are about 3 ways you could do it, I ended up doing...

$ads_percentage_today = $dns_queries_today ? ($ads_blocked_today / $dns_queries_today * 100) : 0;

However your way much easier to read for the casual programmer.

from web.

PromoFaux avatar PromoFaux commented on June 18, 2024

Or a fancy one liner :) (did not know PHP did that, I'm a C# programmer at heart)

from web.

AzureMarker avatar AzureMarker commented on June 18, 2024

It's a common one line if statement. Java has it too. :)

from web.

Related Issues (20)

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.