alexkruc commented on code in PR #25280:
URL: https://github.com/apache/airflow/pull/25280#discussion_r938683101


##########
airflow/www/views.py:
##########
@@ -882,6 +892,18 @@ def index(self):
                 for name, in dagtags
             ]
 
+            owner_links_dict = {}
+            owner_links = session.query(DagOwnerAttributes).all()
+            # The structure we are going for is:
+            # {dag1: {owner1: link1, owner2: link2}, dag2: {owner1: link1}}
+            for owner_link_pair in owner_links:
+                owner_link_pair_dict = owner_link_pair.as_dict()
+                for dag in owner_link_pair_dict:
+                    if dag in owner_links_dict:
+                        owner_links_dict[dag].update(owner_link_pair_dict[dag])
+                    else:
+                        owner_links_dict.update(owner_link_pair_dict)

Review Comment:
   I changed it and deleted the `as_dict`. Your suggestion is indeed more 
elegant and better :) Thanks!



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to