from surveyextractor import QualtricsExtractor
import getopt
import sys

### Script for scheduling regular EdxQualtrics updates
### Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"

# Append directory for dependencies to PYTHONPATH
sys.path.append("/home/dataman/Code/qualtrics_etl/src/qualtrics_etl/")

qe = QualtricsExtractor()
opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses'])
for opt, arg in opts:
    if opt in ('-a', '--reset'):
        qe.resetMetadata()
        qe.resetSurveys()
        qe.resetResponses()
    elif opt in ('-m', '--loadmeta'):
        qe.loadSurveyMetadata()
    elif opt in ('-s', '--loadsurvey'):
        qe.resetSurveys()
        qe.loadSurveyData()
    elif opt in ('-r', '--loadresponses'):
        qe.loadResponseData()

from surveyextractor import QualtricsExtractor
import getopt, sys

# Script for scheduling regular EdxQualtrics updates
# Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"

qe = QualtricsExtractor()
opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses'])
for opt, arg in opts:
    if opt in ('-a', '--reset'):
        qe.resetMetadata()
        qe.resetSurveys()
        qe.resetResponses()
    elif opt in ('-m', '--loadmeta'):
        qe.loadSurveyMetadata()
    elif opt in ('-s', '--loadsurvey'):
        qe.resetSurveys()
        qe.loadSurveyData()
    elif opt in ('-r', '--loadresponses'):
        qe.loadResponseData()

Revert "Added script for cron job to load surveys to database."
Revert "Added script for cron job to load surveys to database."

This reverts commit 34e5560437348e5cfeab589b783c9cc524aa2abf.

  from surveyextractor import QualtricsExtractor
- import getopt
+ import getopt, sys
- import sys
  
- ### Script for scheduling regular EdxQualtrics updates
+ # Script for scheduling regular EdxQualtrics updates
- ### Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"
+ # Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"
- 
- # Append directory for dependencies to PYTHONPATH
- sys.path.append("/home/dataman/Code/qualtrics_etl/src/qualtrics_etl/")
  
  qe = QualtricsExtractor()
  opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses'])
  for opt, arg in opts:
      if opt in ('-a', '--reset'):
          qe.resetMetadata()
          qe.resetSurveys()
          qe.resetResponses()
      elif opt in ('-m', '--loadmeta'):
          qe.loadSurveyMetadata()
      elif opt in ('-s', '--loadsurvey'):
          qe.resetSurveys()
          qe.loadSurveyData()
      elif opt in ('-r', '--loadresponses'):
          qe.loadResponseData()
  
Revert "Added script for cron job to load surveys to database."
## Code Before:
from surveyextractor import QualtricsExtractor
import getopt
import sys

### Script for scheduling regular EdxQualtrics updates
### Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"

# Append directory for dependencies to PYTHONPATH
sys.path.append("/home/dataman/Code/qualtrics_etl/src/qualtrics_etl/")

qe = QualtricsExtractor()
opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses'])
for opt, arg in opts:
    if opt in ('-a', '--reset'):
        qe.resetMetadata()
        qe.resetSurveys()
        qe.resetResponses()
    elif opt in ('-m', '--loadmeta'):
        qe.loadSurveyMetadata()
    elif opt in ('-s', '--loadsurvey'):
        qe.resetSurveys()
        qe.loadSurveyData()
    elif opt in ('-r', '--loadresponses'):
        qe.loadResponseData()

## Instruction:
Revert "Added script for cron job to load surveys to database."
## Code After:
from surveyextractor import QualtricsExtractor
import getopt, sys

# Script for scheduling regular EdxQualtrics updates
# Usage for cron should be "cronRefreshEdxQualtrics.py -m -s -r"

qe = QualtricsExtractor()
opts, args = getopt.getopt(sys.argv[1:], 'amsr', ['--reset', '--loadmeta', '--loadsurveys', '--loadresponses'])
for opt, arg in opts:
    if opt in ('-a', '--reset'):
        qe.resetMetadata()
        qe.resetSurveys()
        qe.resetResponses()
    elif opt in ('-m', '--loadmeta'):
        qe.loadSurveyMetadata()
    elif opt in ('-s', '--loadsurvey'):
        qe.resetSurveys()
        qe.loadSurveyData()
    elif opt in ('-r', '--loadresponses'):
        qe.loadResponseData()
