@@ -180,18 +180,24 @@ defmodule Transport.DatasetIndex do
180180 end
181181
182182 defp matches_filters? ( entry , params ) do
183+ matches_dataset_filters? ( entry , params ) and matches_resource_filters? ( entry , params )
184+ end
185+
186+ defp matches_dataset_filters? ( entry , params ) do
183187 match_type? ( entry , params ) and
184188 match_subtype? ( entry , params ) and
185189 match_licence? ( entry , params ) and
186190 match_has_realtime? ( entry , params ) and
187- match_format? ( entry , params ) and
188191 match_region? ( entry , params ) and
189192 match_custom_tag? ( entry , params ) and
190193 match_organization_id? ( entry , params ) and
191- match_modes? ( entry , params ) and
192194 match_offer? ( entry , params )
193195 end
194196
197+ defp matches_resource_filters? ( entry , params ) do
198+ match_format? ( entry , params ) and match_modes? ( entry , params )
199+ end
200+
195201 defp match_type? ( _entry , % { "type" => type } ) when type in [ nil , "" ] , do: true
196202 defp match_type? ( entry , % { "type" => type } ) , do: entry . type == type
197203 defp match_type? ( _entry , _params ) , do: true
@@ -280,25 +286,23 @@ defmodule Transport.DatasetIndex do
280286 pan_publisher = Application . fetch_env! ( :transport , :datagouvfr_transport_publisher_id )
281287
282288 dataset_ids
283- |> Enum . sort_by (
284- fn id ->
285- entry = index [ id ]
286-
287- base_nationale_priority =
288- if to_string ( entry . organization_id ) == pan_publisher and
289- is_binary ( entry . custom_title ) and
290- String . starts_with? ( String . downcase ( entry . custom_title ) , "base nationale" ) do
291- 0
292- else
293- 1
294- end
295-
296- population = - ( entry . population || 0 )
297- title = ( entry . custom_title || "" ) |> String . downcase ( )
298-
299- { base_nationale_priority , population , title }
300- end
301- )
289+ |> Enum . sort_by ( fn id ->
290+ entry = index [ id ]
291+
292+ base_nationale_priority =
293+ if to_string ( entry . organization_id ) == pan_publisher and
294+ is_binary ( entry . custom_title ) and
295+ String . starts_with? ( String . downcase ( entry . custom_title ) , "base nationale" ) do
296+ 0
297+ else
298+ 1
299+ end
300+
301+ population = - ( entry . population || 0 )
302+ title = ( entry . custom_title || "" ) |> String . downcase ( )
303+
304+ { base_nationale_priority , population , title }
305+ end )
302306 end
303307
304308 defp all_regions do
0 commit comments