mozilla-l10n/langchecker

Optimize global status Json API

TheoChevalier opened this issue · 3 comments

In this query for instance (globalstatus view), we should return only the status for the fr locale:
http://l10n.mozilla-community.org/~pascalc/langchecker/?locale=fr&website=0&json&file=main.lang
We should return results for all locales only when locale=all

In the script that's extracting data from SVN, I'm evilly using this API so I guess fetching results for 1 locale vs. 90 will help.

I won't fix it now since Flod's rewrite is pending, so I'm opening the issue because I know I'll forgot about it :)

Just to make an easy question a lot more complicated, given that I thought about it in the last days :-)

We currently have /?website=SITEID&file=FILEID&locale=all, which gives the same result of /?website=SITEID&file=FILEID&locale=fr.

The second URL is kind of confusing, since we require a locale for a global view of all locales. But we can't reach case 5 without a locale set.

Maybe we could have a view /?website=SITEID&file=FILEID equivalent to the current, adding &jsongives you the full record for all locales. Then redirect ````/?website=SITEID&file=FILEID&locale=XXXXXto/?website=SITEID&file=FILEID` for web view, serve the limited json if locale != 'all'

Last thought: the entire logic in index.php should be in Langchecker::Project, with tests. A simple function that takes an array of parameters extracted from URL, and return the name of the view to use and if we need the template.

It's way too easy to break things with that many conditions, and it already happened in the past.

Per discussion over IRC, looking into this one.

Fixed by #143