diff --git a/physionet-django/console/templates/console/training_type/course_details.html b/physionet-django/console/templates/console/training_type/course_details.html index 6a85a3ef7..4781d8944 100644 --- a/physionet-django/console/templates/console/training_type/course_details.html +++ b/physionet-django/console/templates/console/training_type/course_details.html @@ -79,19 +79,16 @@

Active Versions

class="fa fa-download"> Download -
+ {% csrf_token %} - - +
{% endfor %} -

Note: Users that have taken the particular version of the course that is getting expired, - will need to retake the course or else they will loose credentialing after the - date specified above while expiring the course.

+

Note: Users can no longer take the course if there are no active versions available.

Archived Versions

diff --git a/physionet-django/console/urls.py b/physionet-django/console/urls.py index 59f93f169..6cb3c7e16 100644 --- a/physionet-django/console/urls.py +++ b/physionet-django/console/urls.py @@ -166,7 +166,7 @@ path('courses//download/', training_views.download_course, name='download_course_version'), path('courses//expire/', - training_views.expire_course, name='expire_course_version'), + training_views.archive_course, name='archive_course_version'), ] # Parameters for testing URLs (see physionet/test_urls.py) diff --git a/physionet-django/training/views.py b/physionet-django/training/views.py index ea956fa21..fc292630c 100644 --- a/physionet-django/training/views.py +++ b/physionet-django/training/views.py @@ -183,28 +183,17 @@ def course_details(request, training_slug): @permission_required('training.change_course', raise_exception=True) @console_permission_required('training.change_course') -def expire_course(request, training_slug, version): +def archive_course(request, training_slug, version): """ This view takes a primary key and a version number as input parameters, - and expires the course with the specified primary key and version number. + and archives the course with the specified primary key and version number. """ course = Course.objects.filter(training_type__slug=training_slug, version=version).first() - expiry_date = request.POST.get('expiry_date') if not course: messages.error(request, 'Course not found') return redirect('courses') - if not expiry_date: - messages.error(request, 'Expiry Date is required') - return redirect('course_details', training_slug) - # Checking if the expiry date is greater than the current date - expiry_date_tz = timezone.make_aware(timezone.datetime.strptime(expiry_date, '%Y-%m-%d')) - if expiry_date_tz < timezone.now(): - messages.error(request, 'Expiry Date should be greater than the current date') - return redirect('course_details', training_slug) - # Calculating the number of days between the current date and the expiry date - number_of_days = (expiry_date_tz - timezone.now()).days - course.expire_course_version(int(number_of_days)) - messages.success(request, 'Course expired successfully.') + course.archive_course_version() + messages.success(request, 'Course archived successfully.') return redirect('course_details', training_slug)