Skip to content
Snippets Groups Projects
Unverified Commit 72f3b9a8 authored by Cam Saul's avatar Cam Saul
Browse files

Code deduplication & indentation fixes :wrench:

parent 2daa4b56
No related branches found
No related tags found
No related merge requests found
......@@ -217,14 +217,14 @@
:collection_id collection_id
:collection_position collection_position}
dashboard (db/transaction
;; Adding a new dashboard at `collection_position` could cause other dashboards in this collection to change
;; position, check that and fix up if needed
(api/maybe-reconcile-collection-position! dashboard-data)
;; Ok, now save the Dashboard
(u/prog1 (db/insert! Dashboard dashboard-data)
;; Get cards from existing dashboard and associate to copied dashboard
(doseq [card (:ordered_cards existing-dashboard)]
(api/check-500 (dashboard/add-dashcard! <> (:card_id card) card)))))]
;; Adding a new dashboard at `collection_position` could cause other dashboards in this
;; collection to change position, check that and fix up if needed
(api/maybe-reconcile-collection-position! dashboard-data)
;; Ok, now save the Dashboard
(u/prog1 (db/insert! Dashboard dashboard-data)
;; Get cards from existing dashboard and associate to copied dashboard
(doseq [card (:ordered_cards existing-dashboard)]
(api/check-500 (dashboard/add-dashcard! <> (:card_id card) card)))))]
(events/publish-event! :dashboard-create dashboard)))
......@@ -233,13 +233,7 @@
(api/defendpoint GET "/:id"
"Get `Dashboard` with ID."
[id]
(u/prog1 (-> (Dashboard id)
api/check-404
(hydrate [:ordered_cards :card :series] :can_write)
api/read-check
api/check-not-archived
hide-unreadable-cards
add-query-average-durations)
(u/prog1 (get-dashboard id)
(events/publish-event! :dashboard-read (assoc <> :actor_id api/*current-user-id*))))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment