Skip to content

Commit

Permalink
fix: update csv import error messages
Browse files Browse the repository at this point in the history
update csv error according discussed

Ticket[au-66]

version bump

update changelog
  • Loading branch information
leangseu-edx committed Jul 26, 2021
1 parent af40287 commit dd713b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Change Log
.. There should always be an "Unreleased" section for changes pending release.
Unreleased
[0.8.14] - 2021-07-12
* Update csv import error message
~~~~~~~~~~
[0.8.13] - 2021-07-12
* Fix bug where we ignore repeat user in the csv import
Expand Down
2 changes: 1 addition & 1 deletion bulk_grades/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
Support for bulk scoring and grading.
"""

__version__ = '0.8.13'
__version__ = '0.8.14'

default_app_config = 'bulk_grades.apps.BulkGradesConfig' # pylint: disable=invalid-name
9 changes: 7 additions & 2 deletions bulk_grades/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,13 @@ def post(self, request, course_id, *args, **kwargs):
data = self.processor.status()
data['error_messages'] = []
for error_message in self.processor.error_messages:
line_numbers = ', #'.join(str(line_number+1) for line_number in self.processor.error_messages[error_message])
data['error_messages'].append(f'{error_message} on lines (#{line_numbers})')
line_numbers = ', '.join(str(line_number+1) for line_number in self.processor.error_messages[error_message])
new_message = '{error_message} on line{is_plural} {line_numbers}'.format(
error_message=error_message,
is_plural='s' if len(line_numbers) > 1 else '',
line_numbers=line_numbers
)
data['error_messages'].append(new_message)

log.info('Processed file %s for %s -> %s saved, %s processed, %s error. (async=%s)',
the_file.name,
Expand Down

0 comments on commit dd713b6

Please sign in to comment.