diff options
Diffstat (limited to 'app/finders/achievements/achievements_finder.rb')
-rw-r--r-- | app/finders/achievements/achievements_finder.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/app/finders/achievements/achievements_finder.rb b/app/finders/achievements/achievements_finder.rb new file mode 100644 index 00000000000..98bd12afcd4 --- /dev/null +++ b/app/finders/achievements/achievements_finder.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module Achievements + class AchievementsFinder + attr_reader :namespace, :params + + def initialize(namespace, params = {}) + @namespace = namespace + @params = params + end + + def execute + achievements = namespace.achievements + by_ids(achievements) + end + + private + + def by_ids(achievements) + return achievements unless ids? + + achievements.id_in(params[:ids]) + end + + def ids? + params[:ids].present? + end + end +end |