Polished postmigration scripts

This commit is contained in:
Keannu Bernasol 2023-07-23 23:19:47 +08:00
parent 80f8aa5d66
commit 97374442f7
2 changed files with 3 additions and 3 deletions

View file

@ -41,7 +41,7 @@ def populate_subjects(sender, **kwargs):
csv_files = [f for f in os.listdir(root_path) if f.endswith('.csv')] csv_files = [f for f in os.listdir(root_path) if f.endswith('.csv')]
added_courses = 0 added_courses = 0
existing_courses = 0 existing_courses = 0
print('Adding courses\n') print('--- Adding Courses ---')
for csv_file in csv_files: for csv_file in csv_files:
# The filename contains coursename # The filename contains coursename
filename = os.path.splitext(csv_file)[0] filename = os.path.splitext(csv_file)[0]
@ -65,4 +65,4 @@ def populate_subjects(sender, **kwargs):
added_courses += 1 added_courses += 1
print('Added', added_courses, 'courses') print('Added', added_courses, 'courses')
print(existing_courses, 'existing courses skipped\n') print('Skipped', existing_courses, 'already existing courses\n')

View file

@ -88,7 +88,7 @@ def populate_subjects(sender, **kwargs):
csv_file_path = os.path.join(root_path, csv_file) csv_file_path = os.path.join(root_path, csv_file)
# Filename contains course of subjects # Filename contains course of subjects
filename = os.path.splitext(csv_file)[0] filename = os.path.splitext(csv_file)[0]
print('Reading subjects from', filename) print('---', 'Adding Subjects from', filename, '---')
with open(csv_file_path, newline='') as csvfile: with open(csv_file_path, newline='') as csvfile:
reader = csv.reader(csvfile) reader = csv.reader(csvfile)