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

Filters on Treemap change button not defaulting to current settings properly #460

Closed
markbrough opened this Issue May 21, 2012 · 4 comments

Comments

Projects
None yet
2 participants
@markbrough

markbrough commented May 21, 2012

When you click Change under the Treemap, the settings that appear don't default to the current settings properly. I think this is mostly a problem to do with components of a dimension (e.g. label being the default selected property rather than name)

For example, on the IATI dataset http://openspending.org/iati

Click Change

  • the correct filter would be Transaction Type : name : d
  • the displayed filter is Transaction Type : label : D

This becomes more problematic when you have labels with spaces in them, e.g.
http://openspending.org/iati/sector/22040
-> click Change

@vitorbaptista

This comment has been minimized.

Contributor

vitorbaptista commented Jul 9, 2012

This looks related to https://github.com/openspending/openspendingjs/blob/master/app/bob/bob.js#L400-401

In those lines, we get the element ("transaction_type.name"), split by "." and ignore the second part ("name"). Then, we're calling self.addFilter(null, "transaction_type", undefined, undefined).

We change an undefined attribute to "label" in https://github.com/openspending/openspendingjs/blob/master/app/bob/bob.js#L335.

Couldn't find where we're changing the undefined value to "D" though.

@markbrough

This comment has been minimized.

markbrough commented Jul 10, 2012

"Couldn't find where we're changing the undefined value to "D" though."

@vitorbaptista - it's probably just because it's the first element in the list?

@vitorbaptista

This comment has been minimized.

Contributor

vitorbaptista commented Jul 10, 2012

@markbrough Yes, you're right.

It goes to https://github.com/openspending/openspendingjs/blob/master/app/bob/bob.js#L104, with

dimension == "transaction_type"
attribute == "label" (should be name)
query == undefined

If we check the result, with curl "http://openspending.org/iati/transaction_type.distinct?attribute=name&limit=20", we get

{
  "count": 8, 
  "results": [
    {
      "taxonomy": "iati-tx-type", 
      "label": "\n          D\n        ", 
      "id": 8, 
      "name": "disbursement"
    }, 
...

So it looks that the user was able to add a label with line breaks in it. Is it valid?

@vitorbaptista

This comment has been minimized.

Contributor

vitorbaptista commented Jul 11, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment