Skip to content

Commit

Permalink
Requêteur SIRI : ajuste requête EstimatedTimetable (#3509)
Browse files Browse the repository at this point in the history
* Requêteur SIRI : ajuste requête EstimatedTimetable

* format
  • Loading branch information
AntoineAugusti authored Oct 6, 2023
1 parent 07d01b2 commit d3b6669
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 9 additions & 5 deletions apps/transport/lib/siri_queries.ex
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ defmodule Transport.SIRI do
def line_refs_element([] = _line_refs), do: nil

def line_refs_element(line_refs) do
line_refs = Enum.map(line_refs, &element("siri:LineRef", [], &1))

element("siri:Lines", [], [
element("siri:LineDirection", [], line_refs)
])
element(
"siri:Lines",
[],
Enum.map(line_refs, fn line_ref ->
element("siri:LineDirection", [], [
element("siri:LineRef", [], line_ref)
])
end)
)
end

def append_if_not_nil(list, nil), do: list
Expand Down
2 changes: 2 additions & 0 deletions apps/transport/test/transport/siri_queries_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ defmodule Transport.SIRITest do
<siri:Lines>
<siri:LineDirection>
<siri:LineRef>#{line_001}</siri:LineRef>
</siri:LineDirection>
<siri:LineDirection>
<siri:LineRef>#{line_002}</siri:LineRef>
</siri:LineDirection>
</siri:Lines>
Expand Down

0 comments on commit d3b6669

Please sign in to comment.