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 @@ -568,16 +568,16 @@ def _create_sample(
568
568
elif isinstance (creator , str ):
569
569
additional_creator_ids .append (ObjectId (creator ))
570
570
571
- new_sample ["creator_ids" ]. extend ( additional_creator_ids )
572
-
573
- for creator in sample_dict [ "additional_creators" ]:
574
- if isinstance ( creator , dict ):
575
- new_sample ["creators" ]. append (
576
- {
577
- "display_name" : creator . get ( "display_name" , "" ),
578
- "contact_email" : creator . get ( "contact_email" , "" ),
579
- }
580
- )
571
+ new_sample ["creator_ids" ] = list ( dict . fromkeys ( new_sample [ "creator_ids" ]) )
572
+
573
+ seen_creators = set ()
574
+ unique_creators = []
575
+ for creator in new_sample ["creators" ]:
576
+ creator_key = ( creator . get ( "display_name" , "" ), creator . get ( "contact_email" , "" ))
577
+ if creator_key not in seen_creators :
578
+ seen_creators . add ( creator_key )
579
+ unique_creators . append ( creator )
580
+ new_sample [ "creators" ] = unique_creators
581
581
582
582
if "share_with_groups" in sample_dict and sample_dict ["share_with_groups" ]:
583
583
group_ids = []
You can’t perform that action at this time.
0 commit comments