Skip to content
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

Responses should follow the principle of least astonishment #6108

Closed
Ravenstine opened this issue Sep 2, 2014 · 2 comments
Closed

Responses should follow the principle of least astonishment #6108

Ravenstine opened this issue Sep 2, 2014 · 2 comments
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. worksforme The issue cannot be reproduced and things work as intended.

Comments

@Ravenstine
Copy link

For example, Piwik::Referers.getKeywords will normally return an array of hashes if the site has multiple keywords.

However, if the site is new and has a single keyword, won't return a hash but instead a single hash. Instead, that same hash should be returned inside an array to reduce the extra code necessary.

If a site has no keywords, the response is a single hash: {"nb_visits" => 0}

This is not only unnecessary, but it is yet again another case that require extra code to be written.

Instead, an empty array should be the result.

@mattab
Copy link
Member

mattab commented Sep 3, 2014

Hi @Ravenstine thanks for the report. Maybe you could show an example of the bug in action eg. on demo.piwik.org and give the output report and what you expected to see instead? then we will schedule the bug for a fix.

@mattab mattab added Bug labels Sep 3, 2014
@mattab mattab added this to the Short term milestone Sep 3, 2014
@Ravenstine
Copy link
Author

I apologize; this issue was meant for the piwik-ruby-api. Thanks for the fast response. My mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. worksforme The issue cannot be reproduced and things work as intended.
Projects
None yet
Development

No branches or pull requests

2 participants