Open oakmac opened 1 month ago
Another one from src/metabase/api/automagic_dashboards.clj:
(api/defendpoint GET "/model_index/:model-index-id/primary_key/:pk-id"
"Return an automagic dashboard for an entity detail specified by `entity`
with id `id` and a primary key of `indexed-value`."
[model-index-id pk-id]
{model-index-id :int
pk-id :int}
(api/let-404 [model-index (t2/select-one ModelIndex model-index-id)
model (t2/select-one Card (:model_id model-index))
model-index-value (t2/select-one ModelIndexValue
:model_index_id model-index-id
:model_pk pk-id)]
;; `->entity` does a read check on the model but this is here as well to be extra sure.
(api/read-check Card (:model_id model-index))
(let [linked (linked-entities {:model model
:model-index model-index
:model-index-value model-index-value})]
(create-linked-dashboard {:model model
:linked-tables linked
:model-index model-index
:model-index-value model-index-value}))))
This is currently formatted to:
(api/defendpoint GET "/model_index/:model-index-id/primary_key/:pk-id"
"Return an automagic dashboard for an entity detail specified by `entity`
with id `id` and a primary key of `indexed-value`."
[model-index-id pk-id]
{model-index-id :int
pk-id :int}
(api/let-404 [model-index (t2/select-one ModelIndex model-index-id)
model (t2/select-one Card (:model_id model-index))
model-index-value (t2/select-one ModelIndexValue
:model_index_id model-index-id
:model_pk pk-id)]
;; `->entity` does a read check on the model but this is here as well to be extra sure.
(api/read-check Card (:model_id model-index))
(let [linked (linked-entities {:model model
:model-index model-index
:model-index-value model-index-value})]
(create-linked-dashboard {:model model
:linked-tables linked
:model-index model-index
:model-index-value model-index-value}))))
In both cases, the ;; comment
is causing the odd alignment.
In the first case, not sure how to automatically detect / fix this.
In the second case, arguably the comment should be de-dented.
Test case from metabase/analyze/fingerprint/fingerprinters.clj:
This is currently formatted to:
This seems wrong to me?