Index: openacs-4/packages/acs-lang/www/admin/package-list.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/acs-lang/www/admin/Attic/package-list.xql,v
diff -u -N -r1.1.2.2 -r1.1.2.3
--- openacs-4/packages/acs-lang/www/admin/package-list.xql 12 Apr 2019 12:49:05 -0000 1.1.2.2
+++ openacs-4/packages/acs-lang/www/admin/package-list.xql 12 Apr 2019 13:48:39 -0000 1.1.2.3
@@ -4,61 +4,36 @@
- select q.*,
- (select count(*)
- from lang_messages lm1 left outer join
- lang_messages lm2 on
- (lm2.locale = :current_locale
- and lm2.message_key = lm1.message_key
- and lm2.package_key = lm1.package_key),
- lang_message_keys lmk
- where lm1.locale = :default_locale
- and lm1.package_key = q.package_key
- and lm1.message_key = lmk.message_key
- and lm1.package_key = lmk.package_key
- and lm2.message is not null
- and lm1.deleted_p = 'f'
- and lm2.deleted_p = 'f'
- ) as num_translated,
- (select count(*)
- from lang_messages lm1 left outer join
- lang_messages lm2 on
- (lm2.locale = :current_locale
- and lm2.message_key = lm1.message_key
- and lm2.package_key = lm1.package_key),
- lang_message_keys lmk
- where lm1.locale = :default_locale
- and lm1.package_key = q.package_key
- and lm1.message_key = lmk.message_key
- and lm1.package_key = lmk.package_key
- and lm2.message is null
- and lm1.deleted_p = 'f'
- and (lm2.deleted_p = 'f' or lm2.deleted_p is null)
- ) as num_untranslated,
- (select count(*)
- from lang_messages lm1 left outer join
- lang_messages lm2 on
- (lm2.locale = :current_locale
- and lm2.message_key = lm1.message_key
- and lm2.package_key = lm1.package_key),
- lang_message_keys lmk
- where lm1.locale = :default_locale
- and lm1.package_key = q.package_key
- and lm1.message_key = lmk.message_key
- and lm1.package_key = lmk.package_key
- and (lm1.deleted_p = 't' or lm2.deleted_p = 't')
- ) as num_deleted
- from (select package_key,
- count(message_key) as num_messages
- from lang_messages
- where locale = :default_locale
- group by package_key
- ) q
- order by package_key
+ select
+ package_key,
+ count(*) as num_messages,
+ count(message_is_not_null + messages_not_deleted) as num_translated,
+ count(message_is_null + default_message_not_deleted + message_not_deleted) as num_untranslated,
+ count(any_message_deleted) as num_deleted
+ from (
+ select
+ lm1.package_key,
+ case when lm2.message is null then 1 end message_is_null,
+ case when lm2.message is not null then 1 end message_is_not_null,
+ case when lm1.deleted_p = 't' or lm2.deleted_p = 't' then 1 end any_message_deleted,
+ case when lm1.deleted_p = 'f' and lm2.deleted_p = 'f' then 1 end messages_not_deleted,
+ case when lm1.deleted_p = 'f' then 1 end default_message_not_deleted,
+ case when lm2.deleted_p = 'f' or lm2.deleted_p is null then 1 end message_not_deleted
+ from
+ lang_messages lm1 left outer join
+ lang_messages lm2 on (
+ lm2.locale = :current_locale
+ and lm2.message_key = lm1.message_key
+ and lm2.package_key = lm1.package_key
+ )
+ where
+ lm1.locale = :default_locale
+ ) lang_messages
+ group by package_key
+ order by package_key;
-