FAQ | This is a LIVE service | Changelog

Skip to content
Snippets Groups Projects
Commit 2a75f271 authored by J.W. Smith's avatar J.W. Smith
Browse files

fix: Configurable survey server downtime

There are now three different functions used to download surveys from
three different server types: ODK, kobotoolbox and WRSIS. All three
functions can use past downloads if there is no connection currently, but
they have different hard-coded settings. This fix makes them
consistent and configurable with the config parameter
['Survey']['AcceptableDowntimeDays'].
parent 6f69b7f9
No related branches found
No related tags found
No related merge requests found
......@@ -360,7 +360,10 @@ def get_ODK_form_as_csv(form_credentials: dict, jobPath: str, config: dict, stat
ODK_copy_success = False
days_back = 1
while ((not ODK_copy_success) and (days_back <= 21)):
acceptable_days_back = int(config['Survey']['AcceptableDowntimeDays'])
logger.debug(f"Acceptable server downtime is set to {acceptable_days_back} days")
while ((not ODK_copy_success) and (days_back <= acceptable_days_back)):
current_date = datetime.datetime.strptime(config['StartString'],'%Y%m%d')
past_date = current_date - datetime.timedelta(days=days_back)
......@@ -700,7 +703,10 @@ def get_kobotoolbox_form_as_csv(form_credentials: dict, jobPath: str, config: di
copy_success = False
days_back = 1
while ((not copy_success) and (days_back <= 7)):
acceptable_days_back = int(config['Survey']['AcceptableDowntimeDays'])
logger.debug(f"Acceptable server downtime is set to {acceptable_days_back} days")
while ((not copy_success) and (days_back <= acceptable_days_back)):
current_date = datetime.datetime.strptime(config['StartString'],'%Y%m%d')
......@@ -964,7 +970,10 @@ def get_WRSIS_form_as_csv(form_credentials: dict, jobPath: str, config: dict, st
copy_success = False
days_back = 1
while ((not copy_success) and (days_back <= 7)):
acceptable_days_back = int(config['Survey']['AcceptableDowntimeDays'])
logger.debug(f"Acceptable server downtime is set to {acceptable_days_back} days")
while ((not copy_success) and (days_back <= acceptable_days_back)):
current_date = datetime.datetime.strptime(config['StartString'],'%Y%m%d')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment