Bug 1064737 - Statistics on locale documents page are incorrect (inconsistent with project version and editor)
Statistics on locale documents page are incorrect (inconsistent with project ...
Status: CLOSED CURRENTRELEASE
Product: Zanata
Classification: Community
Component: Component-Logic (Show other bugs)
3.2
Unspecified Unspecified
urgent Severity urgent
: ---
: 3.3
Assigned To: Alex Eng
Zanata-QA Mailling List
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-13 03:23 EST by Ding-Yi Chen
Modified: 2014-03-20 01:47 EDT (History)
4 users (show)

See Also:
Fixed In Version: 3.3.0-SNAPSHOT (20140217-1515)
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2014-03-20 01:47:25 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ding-Yi Chen 2014-02-13 03:23:33 EST
Description of problem:
We found that total number of messages of same number might be shown differently in GWT and JSF.

In 
https://translate.zanata.org/zanata/webtrans/translate?project=ovirt&iteration=master&localeId=de&locale=en#view:doc;doc:frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums

We found that in GWT, the total number of messages in that document is 450.
However, in JSF, the total number of messages in that document is 422.

Version-Release number of selected component (if applicable):
3.2.3
Also in Zanata 3.3.0-SNAPSHOT (20140213-0020) 

How reproducible:
Sometimes

Steps to Reproduce:
1. Visit document 
https://translate.zanata.org/zanata/webtrans/translate?project=ovirt&iteration=master&localeId=de&locale=en#view:doc;doc:frontend/webadmin/modules/uicompat/src/main/resources/org/ovirt/engine/ui/uicompat/LocalizedEnums

2. Go to GWT document list, hover on the document name "LocalizedEnums"
   The total messages here is 450.
3. Click the breadcomb "master", then click the document icon in "de" locale.
4. Switch the statistic to show "Messages"
5. Hover on the document name "LocalizedEnums", the total messages here is 424.

Actual results:
Total messages number in GWT (450) is different with the one in JSF (412).

Expected results:
Total messages number in GWT is the same with the one in JSF.


Additional info:
Comment 2 Sean Flanigan 2014-02-13 19:40:16 EST
The problem can be seen by comparing the JSF pages, without having to look at the GWT editor.  Just add up the stats on the JSF documents page for one of the locales (apparently wrong) and compare to the project version page's stats for that locale (apparently correct).  

The stats on the project version page agree with the project group page and with the editor's doclist stats, and the total number of textflows in a document there agrees with the database.
Comment 3 Alex Eng 2014-02-13 19:41:20 EST
Both pages uses different method on constructing the statistic, 

editor uses : StatisticServiceImpl.getDocStatistics(Long documentId, LocaleId localeId)

jsf uses: StatisticServiceImpl.getStatistics(String projectSlug, String iterationSlug, String docId, boolean includeWordStats, String[] locales)
Comment 4 Sean Flanigan 2014-02-13 19:54:04 EST
StatisticServiceImpl.getStatistics(String projectSlug, String iterationSlug, String docId, boolean includeWordStats, String[] locales) [currently broken] should call 

StatisticServiceImpl.getDocStatistics(Long documentId, LocaleId localeId) [working].
Comment 5 Alex Eng 2014-02-13 20:12:40 EST
The difference between these 2 are the single sql query on multiple locales which perform better compare to looping through StatisticServiceImpl.getDocStatistics(Long documentId, LocaleId localeId).
Comment 6 Sean Flanigan 2014-02-13 20:46:22 EST
Ah okay, we should revisit it later then, whilst doing what we can to share logic between the two cases.  But in the meantime, accuracy trumps performance.

Wait, what's the use case for fetching all the locale stats for a single document?  Where do we show that?
Comment 7 Alex Eng 2014-02-13 22:59:16 EST
Pull request:
https://github.com/zanata/zanata-server/pull/376
Comment 8 Alex Eng 2014-02-13 23:48:36 EST
Sean, 
Multiple locales options are only used in client - statistics command
Comment 9 Ding-Yi Chen 2014-02-18 00:33:42 EST
VERIFIED with Zanata 3.3.0-SNAPSHOT (20140217-1515)
Comment 10 Sean Flanigan 2014-02-27 19:46:44 EST
Just to clarify, with this bug:

 - the locale documents page (JSF) had the wrong statistics
 - the project version page (JSF) and the editor doclist (GWT) had the correct statistics

The locale documents page has been corrected so that its statistics now agree with the other two pages.
Comment 11 Sean Flanigan 2014-03-20 01:47:25 EDT
Closing VERIFIED bugs for Zanata server 3.3.2.

Note You need to log in before you can comment on or make changes to this bug.