From 997b00d40fd360f3b3a4d5f9ed3923923828b7a2 Mon Sep 17 00:00:00 2001
From: barillac <barillac>
Date: Mon, 2 Mar 2015 13:37:59 +0000
Subject: [PATCH] bugfix in children copy

SVN: 33539
---
 .../1/dss/reporting-plugins/newbrowserapi/script.py      | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py b/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py
index 2b46f7323a5..720e0004284 100644
--- a/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py
+++ b/plasmid/source/core-plugins/newbrowser/1/dss/reporting-plugins/newbrowserapi/script.py
@@ -249,7 +249,14 @@ def copySample(tr, parameters, tableBuilder):
 	if sampleChildren != None:
 		for sampleChildIdentifier in sampleChildren:
 			child = tr.getSample(sampleChildIdentifier); #Retrieve Sample child to copy
-			copyChildCode = parameters.get("sampleCode") + child.getCode()[child.getCode().index('_'):];
+			
+			copyChildCode = None
+			try: #For autogenerated children that have the code as sufix
+				indexFromCopiedChildrenParentCode = child.getCode().index('_')
+				copyChildCode = parameters.get("sampleCode") + child.getCode()[indexFromCopiedChildrenParentCode:];
+			except: #For all other children
+				copyChildCode = parameters.get("sampleCode") + "_" + child.getCode();
+
 			copyChildIdentifier = "/" + parameters.get("sampleSpace") + "/" + copyChildCode;
 			
 			# Create new sample children
-- 
GitLab