~ihabunek/triglav

c68c901a27a2e39c6e7acce5c5524f2b672d569c — Ivan Habunek 9 months ago 897c77e
Add title and content to error history feed items
1 files changed, 19 insertions(+), 6 deletions(-)

M lib/triglav_web/controllers/zet/errors_controller.ex
M lib/triglav_web/controllers/zet/errors_controller.ex => lib/triglav_web/controllers/zet/errors_controller.ex +19 -6
@@ 10,7 10,6 @@ defmodule TriglavWeb.Zet.ErrorsController do
  end

  def atom(conn, _params) do
    TriglavWeb.Endpoint |> IO.inspect()
    history = Errors.list_history()
    root_url = TriglavWeb.Router.Helpers.url(conn)



@@ 44,11 43,25 @@ defmodule TriglavWeb.Zet.ErrorsController do
      diff: history_item.created_count - history_item.resolved_count
    }

    Entry.new(
      "#{root_url}/zet/errors/history/#{history_item.id}",
      history_item.timestamp,
      nil
    )
    id = "#{root_url}/zet/errors/history/#{history_item.id}"
    title = "Errors count changed #{counts.current} (+#{counts.created} -#{counts.resolved})"

    content = """
      <p>
        Created count: #{counts.created}<br />
        Resolved count: #{counts.resolved}<br />
        Current count: #{counts.current}
      </p>

      <p>
        ZET GTFS feed version: #{history_item.zet_feed_version}<br />
        OSM sequence number: #{history_item.osm_sequence_number}<br />
        Timestamp: #{history_item.timestamp}
      </p>
    """

    Entry.new(id, history_item.timestamp, title)
    |> Entry.content(content, type: "html")
    |> Entry.add_field("counts", counts, nil)
    |> Entry.add_field("osm_sequence_number", nil, history_item.osm_sequence_number)
    |> Entry.add_field("zet_feed_version", nil, history_item.zet_feed_version)