aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-02-17 17:55:56 +0100
committerMax Magorsch <arzano@gentoo.org>2020-02-17 17:55:56 +0100
commit3f1f50b793e338998d368e6990e962888297d8e0 (patch)
treef8f3646348f16414592177f3c51a062d35f1f08b
parentRemove obsolete Dockerfile (diff)
downloadpackages-5-3f1f50b793e338998d368e6990e962888297d8e0.tar.gz
packages-5-3f1f50b793e338998d368e6990e962888297d8e0.tar.bz2
packages-5-3f1f50b793e338998d368e6990e962888297d8e0.zip
Display the correct useflags for each packagev9.0.4
So far, some useflags have not been displayed when viewing a package. This may happen, whenever other local useflags with the same name exist. This behaviour has been fixed in this commit. Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r--app/models/version.rb23
1 files changed, 14 insertions, 9 deletions
diff --git a/app/models/version.rb b/app/models/version.rb
index 3515a0c..f598a44 100644
--- a/app/models/version.rb
+++ b/app/models/version.rb
@@ -172,15 +172,20 @@ class Version
if local_flags.include? flag
result[:local] << local_flag_map[flag].to_hsh
else
- useflag = UseflagRepository.find_by(:name, flag)
-
- # This should not happen, but let's be sure
- next unless useflag
-
- if useflag.scope == 'global'
- result[:global] << useflag.to_hsh
- elsif useflag.scope == 'use_expand'
- result[:use_expand] << useflag.to_hsh
+ # TODO(arzano) we might find a cleaner solution here
+ # e.g. search for all use flags with matching name
+ # that haven't scope=local
+ useflags = UseflagRepository.find_all_by(:name, flag)
+
+ for useflag in useflags do
+ # This should not happen, but let's be sure
+ next unless useflag
+
+ if useflag.scope == 'global'
+ result[:global] << useflag.to_hsh
+ elsif useflag.scope == 'use_expand'
+ result[:use_expand] << useflag.to_hsh
+ end
end
end
end