Skip to content

Commit

Permalink
function to display the last change informations: time and author of …
Browse files Browse the repository at this point in the history
…the modification.
  • Loading branch information
the-last-pastafarian committed Mar 1, 2024
1 parent 18ac33b commit 93cf53b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server/lib/field_hub/couch_service.ex
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ defmodule FieldHub.CouchService do
"id" => "project",
"changes" => []
}

%{"results" => result} ->
Enum.find(result, fn map -> map["seq"] == last_sequence end)
end
Expand All @@ -388,11 +389,12 @@ defmodule FieldHub.CouchService do
## Example
iex> get_last_change_date("development")
"2024-02-29 (edited by André Leroi-Gourhan)"
"""
def get_last_change_date(project_identifier) do
case Map.get(get_last_change_info(project_identifier), "id") do
nil -> :no_changes_found
nil ->
:no_changes_found

result ->
HTTPoison.get!(
"#{base_url()}/#{project_identifier}/#{result}",
Expand Down

0 comments on commit 93cf53b

Please sign in to comment.