Skip to content

Commit

Permalink
fixed the version comparision
Browse files Browse the repository at this point in the history
 Please enter commit message for your changes. Lines starting
  • Loading branch information
Rutvikrj26 committed Sep 13, 2023
1 parent eb932ac commit fd3f8b2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion physionet-django/training/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def courses(request):
if not all(map(lambda x: x.isdigit() or x == '.', str(file_data['courses'][0]['version']))):
messages.error(request, 'Version number is not valid.')
# checking if the version number is greater than the existing version
elif float(file_data['courses'][0]['version']) <= float(existing_course.order_by('-version').first().version):
elif float(file_data['courses'][0]['version']
) <= float(existing_course.order_by('-version').first().version):
messages.error(request, 'Version number should be greater than the existing version.')
else: # Checks passed and moving to saving the course
serializer = TrainingTypeSerializer(training_type, data=file_data, partial=True)
Expand Down

0 comments on commit fd3f8b2

Please sign in to comment.