diff --git a/lib/sanbase/metric/registry/change_suggestion.ex b/lib/sanbase/metric/registry/change_suggestion.ex
index 47d3f5f69..9ac19898b 100644
--- a/lib/sanbase/metric/registry/change_suggestion.ex
+++ b/lib/sanbase/metric/registry/change_suggestion.ex
@@ -145,7 +145,8 @@ defmodule Sanbase.Metric.Registry.ChangeSuggestion do
# After change suggestion is applied, put the metric in a unverified state and mark
# is as not synced. Someone needs to manually verify the metric after it is tested.
# When the data is synced between stage and prod, the sync status will be updated.
- params = Map.merge(params, %{is_verified: false, sync_status: "not_synced"})
+ # Note: Keep the keys as strings, not atoms, so the map is not mixed
+ params = Map.merge(params, %{"is_verified" => false, "sync_status" => "not_synced"})
case Registry.changeset(registry, params) do
%{valid?: false} = changeset ->
diff --git a/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex b/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex
index 5d7257ec9..fd42e685f 100644
--- a/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex
+++ b/lib/sanbase_web/live/metric_registry/metric_registry_change_suggestions_live.ex
@@ -3,6 +3,7 @@ defmodule SanbaseWeb.MetricRegistryChangeSuggestionsLive do
alias SanbaseWeb.AdminFormsComponents
alias Sanbase.Metric.Registry.ChangeSuggestion
+ alias SanbaseWeb.AvailableMetricsComponents
@impl true
def mount(_params, _session, socket) do
@@ -16,12 +17,17 @@ defmodule SanbaseWeb.MetricRegistryChangeSuggestionsLive do
def render(assigns) do
~H"""
<.phx_click_button
@@ -291,17 +291,17 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do
"""
end
- defp filter_not_verified(assigns) do
+ defp filter_unverified(assigns) do
~H"""
"""
@@ -402,7 +402,7 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do
end)
end
- defp maybe_apply_filter(metrics, :match_table, %{"not_verified_only" => "on"}) do
+ defp maybe_apply_filter(metrics, :match_table, %{"unverified_only" => "on"}) do
metrics
|> Enum.filter(fn m ->
m.is_verified == false
@@ -410,4 +410,9 @@ defmodule SanbaseWeb.MetricRegistryIndexLive do
end
defp maybe_apply_filter(metrics, _, _), do: metrics
+
+ defp take_ordered(metrics, ids) do
+ metrics_map = Map.new(metrics, &{&1.id, &1})
+ Enum.map(ids, &Map.get(metrics_map, &1))
+ end
end