cr-connect-workflow/crc/scripts/is_file_uploaded.py
Dan 5c76c90d04 send_file's arguments changed in a 2.2 of Flask.
Spiffworkflow 1.2:  remove all references of timeit (no longer in SpiffWorkflow)
Spiffworkflow 1.2:  pythonScriptEngine._evaluate no longer accepts a task argument.
Spiffworkflow 1.2:  CancelEventDefinition was removed - please use SignalEventDefinition instead
 EX: replace bpmn_workflow.signal('cancel')  # generate a cancel signal.
              bpmn_workflow.catch(CancelEventDefinition())
 WITH: bpmn_workflow.catch(SignalEventDefinition('cancel'))
Spiffworkflow 1.2:  Task States are JUST integers and TaskSpecNames is now a public dictionary, and can be used to covert a state to human readable string
    EX:  REPLACE:  user_task.state.name
         WITH:     TaskStateNames[user_task.state]
2022-10-05 15:31:56 -04:00

22 lines
741 B
Python

from crc.scripts.script import Script
from crc.services.user_file_service import UserFileService
class IsFileUploaded(Script):
def get_description(self):
return """Test whether a file is uploaded for a study.
Pass in the IRB Doc Code for the file."""
def do_task_validate_only(self, task, study_id, workflow_id, *args, **kwargs):
return self.do_task(task, study_id, workflow_id, *args, **kwargs)
def do_task(self, task, study_id, workflow_id, *args, **kwargs):
doc_code = args[0]
files = UserFileService.get_files_for_study(study_id, irb_doc_code=doc_code)
for file in files:
if file.archived is False:
return True
return False