Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/canvas_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,6 @@ def write_data_directory(dataframes, cid):
dir_name (string): directory name
"""

# clear any folders that are currently in there (leave tableau folder)
_clear_data_directory()

course_path = _make_output_dir(cid)
for name, dataframe in dataframes.items():
dataframe.to_csv('{}/{}.csv'.format(course_path, name))
Expand All @@ -195,7 +192,7 @@ def write_data_directory(dataframes, cid):
# '{}/{}.csv'.format(tableau_path, cid))


def _clear_data_directory():
def clear_data_directory():
"""
Clears entire data directory except for Tableau folder
Directory path : module_progress/data
Expand Down
6 changes: 6 additions & 0 deletions src/get_module_progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
get_student_module_status,
get_student_items_status,
write_data_directory,
clear_data_directory,
write_tableau_directory,
log_success,
log_failure)
Expand All @@ -37,13 +38,17 @@ def main():
canvas = usr_settings['canvas']
tableau_dfs = []

# clear any folders that are currently in there (leave tableau folder)
clear_data_directory()

# Getting course information for user-specified courses
# Loops through courses and tries to get module/item information and create Pandas Dataframes
# Writes dataframes to disk if successful
# Prints error and skips course if unsuccessful
for cid in course_ids:
course = canvas.get_course(cid)
# Calling helpers to get data from Canvas and build Pandas DataFrame's

try:
settings.status[str(cid)]['cname'] = course.name
modules_df = get_modules(course)
Expand All @@ -52,6 +57,7 @@ def main():
student_items_status = get_student_items_status(
course, student_module_status)
except KeyError as e:
print(e)
log_failure(cid, e)
except Unauthorized:
log_failure(
Expand Down