mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Improved subjects postmigration print log
This commit is contained in:
parent
c6237ad9b1
commit
b9957eec9e
1 changed files with 7 additions and 3 deletions
|
@ -96,6 +96,7 @@ def populate_subjects(sender, **kwargs):
|
||||||
subject_count = 0
|
subject_count = 0
|
||||||
updated_subjects = 0
|
updated_subjects = 0
|
||||||
ignored_subjects = 0
|
ignored_subjects = 0
|
||||||
|
existing_subjects = 0
|
||||||
for row in reader:
|
for row in reader:
|
||||||
if not any(row):
|
if not any(row):
|
||||||
continue
|
continue
|
||||||
|
@ -132,6 +133,7 @@ def populate_subjects(sender, **kwargs):
|
||||||
# If subject already exists with relevant info, skip over it
|
# If subject already exists with relevant info, skip over it
|
||||||
if (Subject.objects.filter(name=subject_name, year_levels=year_level, semesters=semester).exists()):
|
if (Subject.objects.filter(name=subject_name, year_levels=year_level, semesters=semester).exists()):
|
||||||
# print('Duplicate subject')
|
# print('Duplicate subject')
|
||||||
|
existing_subjects += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Else if subject exists without relevant info, add relevant info
|
# Else if subject exists without relevant info, add relevant info
|
||||||
|
@ -162,7 +164,9 @@ def populate_subjects(sender, **kwargs):
|
||||||
subject_count += 1
|
subject_count += 1
|
||||||
|
|
||||||
# Set the course, year level, and semester of the subject
|
# Set the course, year level, and semester of the subject
|
||||||
print('Added', subject_count, 'subjects from', filename,)
|
print('Skipped', existing_subjects,
|
||||||
print('Updated', updated_subjects, 'subjects from', filename)
|
'already existing subjects')
|
||||||
|
print('Added', subject_count, 'subjects')
|
||||||
|
print('Updated', updated_subjects, 'subjects')
|
||||||
print('Ignored', ignored_subjects,
|
print('Ignored', ignored_subjects,
|
||||||
'subjects from', filename, '\n')
|
'subjects', '\n')
|
||||||
|
|
Loading…
Reference in a new issue