Skip to content

Commit c703697

Browse files
committed
ProcessCurrentExperiment: Factor out json path creation
1 parent 1990c13 commit c703697

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Packages/Conversion/MIES_MassExperimentProcessing.ipf

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ End
8686

8787
static Function ProcessCurrentExperiment(STRUCT MultiExperimentProcessPrefs &prefs)
8888

89-
variable jsonID, index, ref
90-
string outputFilePath, inputFile, outputFolder, history
89+
variable jsonID, ref
90+
string outputFilePath, inputFile, outputFolder, history, path
9191

9292
jsonID = GetJSON(prefs)
9393

@@ -100,9 +100,9 @@ static Function ProcessCurrentExperiment(STRUCT MultiExperimentProcessPrefs &pre
100100

101101
outputFilePath = outputFolder + S_path + GetExperimentName() + ".nwb"
102102

103-
index = JSON_GetVariable(jsonID, "/index")
104-
JSON_AddString(jsonID, "/log/" + num2str(index) + "/from", inputFile)
105-
JSON_AddString(jsonID, "/log/" + num2str(index) + "/to", outputFilePath)
103+
path = "/log/" + num2str(JSON_GetVariable(jsonID, "/index"))
104+
JSON_AddString(jsonID, path + "/from", inputFile)
105+
JSON_AddString(jsonID, path + "/to", outputFilePath)
106106

107107
ref = CaptureHistoryStart()
108108

@@ -111,13 +111,13 @@ static Function ProcessCurrentExperiment(STRUCT MultiExperimentProcessPrefs &pre
111111
PerformMiesTasks(outputFilePath); AbortOnRTE
112112
catch
113113
printf "Caught an RTE or Abort: V_AbortCode=%d\r", V_AbortCode
114-
JSON_AddBoolean(jsonID, "/log/" + num2str(index) + "/error", 1)
114+
JSON_AddBoolean(jsonID, path + "/error", 1)
115115
JSON_SetVariable(jsonID, "/errors", JSON_GetVariable(jsonID, "/errors") + 1)
116116
endtry
117117

118118
history = CaptureHistory(ref, 1)
119119

120-
JSON_AddString(jsonID, "/log/" + num2str(index) + "/output", trimstring(history))
120+
JSON_AddString(jsonID, path + "/output", trimstring(history))
121121

122122
JSON_SetVariable(jsonID, "/processed", JSON_GetVariable(jsonID, "/processed") + 1)
123123
else

0 commit comments

Comments
 (0)