1. ccaih
  2. Untitled project
  3. ccav
  4. Issues
Issue #66 resolved

"Current" is showing up as last item in time slider rather than first option.

repo owner created an issue

Suggested solution rename to 2005 and look at where the naming of "current" is coming from.

Comments (6)

  1. James Mills

    Sam Wolski What is the UI code doing here? IIRC (if I remember correctly) the UI should be using mostly all of the new API at /api/ now right? I don't think I even present current/current/2005 through this API?

  2. Sam Wolski

    This turned out to be a purely UI issue. There's some fallback ordering in the graph script that checks the orders of the year options, and 'current' is equating as > 2015-2085. I've added some type checking that fixes it.

    To answer your question though, the script is using the API for vars. But javascript objects have no ordering, you can't code 'Display first sub-object of data in this main object.' The entire dataset exists without any ordering, javascript has no inherent way to acknowledge objects called '2015', '2025', '2035', etc are in an order, or that one is 'first' - thats all done in the UI (or your console window).

    To get around that, someone tagged the lowest year as 'Current' and uses it to identify which data should be displayed on page load. I'm not 100% sure where that's happening, I didn't add it, but I'm assuming Dan Baird did it so that the tool doesn't rely on a dataset containing a specific year (like '2005').

    I'll push this little fix up. Let me know if this issue requires anything else, otherwise we can resolve it.

  3. James Mills

    I think the issue is a little bigger than this... Perhaps we (Mark, AB, SM) really should decide whether we should keep this functionality or just simply get rid of current altogether.

    RE "JavaScript objects" -- Many of the API(s) actually return arrays, not objects. e.g:

    $ curl -q -o - http://testccav.terranova.org.au/api/Data/years

    What API(s) are responsible for this issue?

  4. Log in to comment