• (nodebb)

    You wait time is frist minutes.

  • Officer Johnny Holzkopf (unregistered) in reply to nerd4sale

    I waited 0 hour and secnod minutes. Erm, snecod minute.

  • (nodebb)
    if (minutes === thrid) { waitTime = "Your wait time is 12 quatloon"); }
    
  • (nodebb)

    Isn't x = parseInt(12, 10) the same as x = 12?

  • Darren (unregistered) in reply to jeremypnet

    That's what I thought. I looked up the 'parseInt' function and from my reading the 'minutes' value will always be 12.

  • Vera (unregistered)

    "12 minute" might have been intended as "1-2 minutes", which raises the question where the dash went. Eh, just add it to the mountain of questions about this piece of malware.

  • Smithers (unregistered)

    I think I get it. The split between client and server logic is the WTF (and the parseInt is pointless), but this does actually work.

    because who cares about pluralization?

    This code does. This whole code exists for the express purpose of caring about pluralisation! Because (and I'm guessing here, but I'm fairly confident) ALL of the 12s and 0s in the text strings are rendered server-side.

    So at 1 minute, it will put a 1 in all the text strings but the user only sees the if ( minutes < 2) { time.innerText = "Your estimated wait time is 1 minute." } case, which has the correct singular. From 2 to 59 minutes you get the else if (minutes < 60) { time.innerText = "Your estimated wait time is $n minutes." } case. At 60 minutes it will render 1 instead of 0 and you get told "1 hour." (minutes < 120 && (minutes % 60 === 1)), which could be shortened to (minutes === 61), gets "1 hour and 1 minute" and so on.

    Heck, the source code probably looks sane if you forget that there's a step in between executing the server-side code and the client-side.

  • Pag (unregistered)

    Yes, 0 (hours) and 12 (minutes) are surely variables on the server side. It will output "1 hour", "1 hour and 1 minute", "1 hour and 2 minutes" and so on, depending on what numbers are slotted into the template.

  • (nodebb) in reply to Smithers

    Just beat me to it.

    Note the line var minutes = parseInt( 12 , 10);. This is rendered from the backend, which is of course my least favorite way to send data from the server side to the client side.

    If you replace all of the instances of 12 and 0 with what the values would be if minutes was in the range checked by the if, the code makes more sense. It's still a major WTF, but at least it isn't just plain completely insane.

  • Malte (unregistered)
    Comment held for moderation.

Leave a comment on “On Hold”

Log In or post as a guest

Replying to comment #:

« Return to Article