99import pageQCL
1010import pageVariable
1111import pageSummary
12- from odm2api .ODM2 .models import Actions
12+ from odm2api .ODM2 .models import *
1313
1414[wxID_PNLINTRO , wxID_PNLVARIABLE , wxID_PNLMETHOD , wxID_PNLQCL ,
1515 wxID_PNLSUMMARY , wxID_WIZSAVE , wxID_PNLEXISTING ,
@@ -226,7 +226,7 @@ def _init_ctrls(self, prnt):
226226
227227 def get_metadata (self ):
228228 # method = self.currSeries.FeatureActionObj.ActionObj.MethodObj
229- # processing_level = self.currSeries .quality_control_level
229+ # processing_level = self.currSeriefs .quality_control_level
230230 # variable = self.currSeries.variable
231231 # action =
232232
@@ -267,9 +267,11 @@ def get_metadata(self):
267267 # Create action
268268 action = Actions ()
269269 action .MethodObj = method
270+ action .MethodID = method .MethodID
270271 action .ActionDescription = self .action_page .action_view .description_text_box .GetValue ()
271272 action .ActionFileLink = self .action_page .action_view .action_file_link_text_box .GetValue ()
272273 action .MethodObj .OrganizationObj = affiliation .OrganizationObj
274+ action .BeginDateTime = self .currSeries .ResultDateTime
273275
274276 return site , variable , method , action , processing_level
275277
@@ -442,8 +444,6 @@ def on_wizard_finished(self, event):
442444 else :
443445 method = self .series_service .get_method_by_code (method .MethodCode )
444446
445-
446-
447447 # initiate either "Save as" or "Save"
448448 '''
449449 if self.page1.pnlIntroduction.rbSave.GetValue():
@@ -452,19 +452,35 @@ def on_wizard_finished(self, event):
452452 result = self.record_service.saveAs(Variable, Method, QCL, True)
453453 '''
454454
455+
456+ #TODO: move all of this stuff into the edit_service file
455457 # Create action
456- new_result = self .series_service .createResult (var = variable , meth = method , proc = proc_level )
458+ new_result = self .series_service .getResult (var = variable , meth = method , proc = proc_level )
459+
457460 # action = self.series_service.create.createAction(action)
458461
462+ affiliation = self .action_page .get_affiliation ()
463+
464+ new_action_by = ActionBy ()
465+ new_action_by .ActionID = action .ActionID
466+ new_action_by .RoleDescription = self .action_page .action_view .role_description_text_box .GetValue ()
467+ new_action_by .AffiliationID = affiliation .AffiliationID
468+ new_action_by .AffiliationObj = affiliation
469+
470+ #TODO end
471+
459472 try :
460473 if rbSave :
461474 result = self .record_service .save ()
462475 elif rbSaveAsNew :
476+ #TODO send in Action, and Actionby
463477 result = self .record_service .save_as (variable , method , proc_level )
464478 elif rbSaveAsExisting :
465479 if overwrite :
480+ #TODO send in just the result
466481 result = self .record_service .save_existing (variable , method , proc_level )
467482 elif append :
483+ #TODO send in just the result
468484 #def save_appending(self, var = None, method =None, qcl = None, overwrite = False):
469485 #TODO if i require that original or new is selected I can call once with overwrite = original
470486 if original :
0 commit comments