Comment 1 for bug 525371

Revision history for this message
Данило Шеган (danilo) wrote : Re: API for reading POTemplates statistics

Adi, just a suggestion on how you should structure this work (you don't have to take it, but it will make it easier for everybody if you at least do similar division of work).

First, I'd do API for single PO file statistics: you'd have to worry about exporting a shared interface IRosettaStats through API, so all the other objects which are based on it will get the same API as well.

Next step would be to figure out a good API for a single potemplate and work on that. Other than the simple properties, the most interesting bit here is how do you get statistics for a bunch of attached PO files. If you don't do anything but just export a single method to list out all the PO files, you'll be doing one API call for each of the languages for a PO template and that's going to be very slow. Eg. to get full status export for Ubuntu out of LP you'd need to do some ~400k API calls.

So, a much better solution to that is to provide a method which gives you all related PO file statistics: "getPOFilesWithStatistics()" which returns tuples of form (POFile, translated_count, changed_count, unreviewed_count, untranslated_count) directly. FWIW, I'd keep this a separate step as well, so this would be bug/branch 3 already :)

And only then, as the final step, I'd do an export of IPOTemplateS(ubs)et APIs for all the different objects that have them. As another part of this step, you'd probably want to do the similar to above and provide a getPOFilesWithStatistics(language) method on them.

If you don't divide the work in this manner, you are going to end up with a gigantic branch that'll be hard to get right and get landed, and everybody will easily get lost about what exactly should be the next step.