File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed
pydatalab/src/pydatalab/routes/v0_1 Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -566,16 +566,16 @@ def _create_sample(
566
566
elif isinstance (creator , str ):
567
567
additional_creator_ids .append (ObjectId (creator ))
568
568
569
- new_sample ["creator_ids" ]. extend ( additional_creator_ids )
570
-
571
- for creator in sample_dict [ "additional_creators" ]:
572
- if isinstance ( creator , dict ):
573
- new_sample ["creators" ]. append (
574
- {
575
- "display_name" : creator . get ( "display_name" , "" ),
576
- "contact_email" : creator . get ( "contact_email" , "" ),
577
- }
578
- )
569
+ new_sample ["creator_ids" ] = list ( dict . fromkeys ( new_sample [ "creator_ids" ]) )
570
+
571
+ seen_creators = set ()
572
+ unique_creators = []
573
+ for creator in new_sample ["creators" ]:
574
+ creator_key = ( creator . get ( "display_name" , "" ), creator . get ( "contact_email" , "" ))
575
+ if creator_key not in seen_creators :
576
+ seen_creators . add ( creator_key )
577
+ unique_creators . append ( creator )
578
+ new_sample [ "creators" ] = unique_creators
579
579
580
580
if "share_with_groups" in sample_dict and sample_dict ["share_with_groups" ]:
581
581
group_ids = []
You can’t perform that action at this time.
0 commit comments