Bug 1064737 - Statistics on locale documents page are incorrect (inconsistent with project version and editor)
Summary: Statistics on locale documents page are incorrect (inconsistent with project ...
Alias: None
Product: Zanata
Classification: Retired
Component: Component-Logic   
(Show other bugs)
Version: 3.2
Hardware: Unspecified Unspecified
Target Milestone: ---
: 3.3
Assignee: Alex Eng
QA Contact: Zanata-QA Mailling List
Depends On:
TreeView+ depends on / blocked
Reported: 2014-02-13 08:23 UTC by Ding-Yi Chen
Modified: 2014-03-20 05:47 UTC (History)
4 users (show)

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

Attachments (Terms of Use)

Description Ding-Yi Chen 2014-02-13 08:23:33 UTC
Description of problem:
We found that total number of messages of same number might be shown differently in GWT and JSF.


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):
Also in Zanata 3.3.0-SNAPSHOT (20140213-0020) 

How reproducible:

Steps to Reproduce:
1. Visit document 

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-14 00:40:16 UTC
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-14 00:41:20 UTC
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-14 00:54:04 UTC
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-14 01:12:40 UTC
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-14 01:46:22 UTC
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-14 03:59:16 UTC
Pull request:

Comment 8 Alex Eng 2014-02-14 04:48:36 UTC
Multiple locales options are only used in client - statistics command

Comment 9 Ding-Yi Chen 2014-02-18 05:33:42 UTC
VERIFIED with Zanata 3.3.0-SNAPSHOT (20140217-1515)

Comment 10 Sean Flanigan 2014-02-28 00:46:44 UTC
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 05:47:25 UTC
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.