lib/queries/source/filter.rb
# TODO: likely move to model (replicated in Source too)
# Params exists for all CollectingEvent attributes except these
likely move to model (replicated in Source too)
Params exists for all CollectingEvent attributes except these
likely move to model ( replicated in Source too ) Params exists for all CollectingEvent attributes except these
def author_ids_facet
        return nil if author_ids.empty?
        o = table
        r = ::Role.arel_table
        a = o.alias("a_")
        b = o.project(a[Arel.star]).from(a)
        c = r.alias('r1')
        b = b.join(c, Arel::Nodes::OuterJoin)
          .on(
            a[:id].eq(c[:role_object_id])
          .and(c[:role_object_type].eq('Source'))
          .and(c[:type].eq('SourceAuthor'))
          )
        e = c[:id].not_eq(nil)
        f = c[:person_id].eq_any(author_ids)
        b = b.where(e.and(f))
        b = b.group(a['id'])
        b = b.having(a['id'].count.eq(author_ids.length)) unless author_ids_or
        b = b.as('aut_z1_')
        ::Source.joins(Arel::Nodes::InnerJoin.new(b, Arel::Nodes::On.new(b['id'].eq(o['id']))))
      end
def author_ids_facet return nil if author_ids . empty? o = table r = :: Role . arel_table a = o . alias ( "a_" ) b = o . project ( a [ Arel . star ] ) . from ( a ) c = r . alias ( 'r1' ) b = b . join ( c , Arel :: Nodes :: OuterJoin ) . on ( a [ :id ] . eq ( c [ :role_object_id ] ) . and ( c [ :role_object_type ] . eq ( 'Source' ) ) . and ( c [ :type ] . eq ( 'SourceAuthor' ) ) ) e = c [ :id ] . not_eq ( nil ) f = c [ :person_id ] . eq_any ( author_ids ) b = b . where ( e . and ( f ) ) b = b . group ( a [ 'id' ] ) b = b . having ( a [ 'id' ] . count . eq ( author_ids . length ) ) unless author_ids_or b = b . as ( 'aut_z1_' ) :: Source . joins ( Arel :: Nodes :: InnerJoin . new ( b , Arel :: Nodes :: On . new ( b [ 'id' ] . eq ( o [ 'id' ] ) ) ) ) end
TODO: likely move to model (replicated in Source too)
Params exists for all CollectingEvent attributes except these
TODO : likely move to model ( replicated in Source too ) Params exists for all CollectingEvent attributes except these