Skip to content
This repository
Browse code

Fix to pending translations estimates on translation tool

  • Loading branch information...
commit 477f2ec860e0884c897849a782304598213a48af 1 parent 609a6f3
Albert Garcia authored August 01, 2012
8  instances/common/models/i18n/translator.model.php
@@ -70,11 +70,11 @@ public function getDifferentLanguages()
70 70
 	public function getStats( $instance, $parent_instance )
71 71
 	{
72 72
 		$parent_instance_sql     = '';
73  
-		$parent_instance_sub_sql = '';
  73
+		$parent_instance_sub_sql = 'm.instance = ? OR t.instance = ?';
74 74
 		if ( $parent_instance )
75 75
 		{
76  
-			$parent_instance_sql     = ' OR instance IS NULL ';
77  
-			$parent_instance_sub_sql = ' OR m.instance IS NULL ';
  76
+			$parent_instance_sql = ' OR instance IS NULL ';
  77
+			$parent_instance_sub_sql = '( m.instance = ? OR m.instance IS NULL ) AND ( t.instance = ? OR t.instance IS NULL )';
78 78
 		}
79 79
 
80 80
 		$sql = <<<TRANSLATIONS
@@ -84,7 +84,7 @@ public function getStats( $instance, $parent_instance )
84 84
 	lc.local_name AS name,
85 85
 	@lang 			:= l.lang AS lang,
86 86
 	@translated 	:= (SELECT COUNT(*) FROM i18n_translations WHERE ( instance = ? $parent_instance_sql ) AND lang = @lang AND translation != '' AND translation IS NOT NULL ) AS total_translated,
87  
-	@total 			:=  (SELECT COUNT(DISTINCT(m.id)) FROM i18n_messages m LEFT JOIN i18n_translations t ON m.id=t.id_message AND t.lang = @lang WHERE ( m.instance = ? OR t.instance = ? $parent_instance_sub_sql ) ) AS total,
  87
+	@total 			:=  (SELECT COUNT(DISTINCT(m.id)) FROM i18n_messages m LEFT JOIN i18n_translations t ON m.id=t.id_message AND t.lang = @lang WHERE $parent_instance_sub_sql ) AS total,
88 88
 	ROUND( ( @translated / @total) * 100, 2 ) AS percent,
89 89
 	( @total - @translated ) AS missing
90 90
 FROM

0 notes on commit 477f2ec

Please sign in to comment.
Something went wrong with that request. Please try again.