Bug 1192271

Summary: For gettext plural project, project-version statistics was inconsistent between language and document ( sometime more than 100%)
Product: [Retired] Zanata Reporter: Ding-Yi Chen <dchen>
Component: Component-LogicAssignee: Alex Eng <aeng>
Status: CLOSED CURRENTRELEASE QA Contact: Ding-Yi Chen <dchen>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.6CC: zanata-bugs
Target Milestone: ---   
Target Release: 3.6   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: 3.6.0-SNAPSHOT (git-jenkins-zanata-server-github-pull-requests-2744) Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-19 07:10:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Statistics shows more than 100% none

Description Ding-Yi Chen 2015-02-13 02:34:21 UTC
Created attachment 991188 [details]
Statistics shows more than 100%

Description of problem:
After pushed translations of gettext plural project, the statistics shown in project-version view was inconsistent between languages and documents. Some documents are over 100%

See the screenshot for detail

Version-Release number of selected component (if applicable):
Zanata 3.6.0-SNAPSHOT (git-server-3.5.1-152-g3b2474e)

How reproducible:
Always

Steps to Reproduce:
1. Download GNU tar-1.27.1 with http://ftp.gnu.org/gnu/tar/tar-1.27.1.tar.gz and extract it 
2. Create project tar, version 1.27.1
3. Upload tar.pot under tar-<ver>/po/tar.pot
4. Upload de.po under tar-<ver>/po/de.po as German translation (de)
5. Go to project-version view of tar/1.27.1
6. Click language tab
7. Click the language German (de)

Actual results:
In languages column, German is 96.62% translated
In Documents column, Document tar is  110.66% translated

Expected results:
In languages column and document column should show same percentage. (96.62%)


Additional info:
Statistics in translation editor was correct.

Comment 1 Alex Eng 2015-02-16 00:33:28 UTC
Statistic looks fine when trying to reproduce the issue with given data. Please try retest with your local cache cleared.

Comment 2 Ding-Yi Chen 2015-02-16 03:31:19 UTC
To reproduce the bug seems more complicate that I originally thought.

My steps to reproduced in test server:
1. Add a new locale in zanata.xml (Add a new language in Zanata server if necessary)

2. Push with 
mvn -e  org.zanata:zanata-maven-plugin:push -Dzanata.pushType=both -Dzanata.srcDir=po -Dzanata.transDir=po -Dzanata.url=$ZANATA_URL

3. In Web UI, check the statistics of new locales.

Actual results:
Statistics of new locales shown in languages column and documents column were inconsistent.

Expected:
Statistics of locales shown in languages column and document are consistent.

Upload from web UI seems fine now.

Workaround: (Admin only)
1.  Go to Administration Menu -> Server Monitoring
2. look for "Data caches", expends it. 
3. Search for "org.zanata.service.impl.TranslationStateCacheImpl.documentStatisticCache", 
4. Click the recycle bin icon at the end of that row

Comment 3 Alex Eng 2015-02-16 06:22:47 UTC
Pull request:
https://github.com/zanata/zanata-server/pull/695

Comment 4 Ding-Yi Chen 2015-02-18 06:05:58 UTC
VERIFIED with Zanata 3.6.0-SNAPSHOT (git-jenkins-zanata-server-github-pull-requests-2744)