Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create training basics --> implement take training feature and resume training feature for user #1951

Open
wants to merge 46 commits into
base: dev
Choose a base branch
from

Conversation

amitupreti
Copy link
Contributor

@amitupreti amitupreti commented Mar 28, 2023

What?

Here i have added a feature that will allow users to take the training from settings. User can choose from a list of available
trainings and take the onplatform training. Users can also see the progress of the training and can resume the training from where they left off.

Why?

This is a follow up PR for #1950

How?

Here we create 3 new views to handle the training.

1. training.views.take_training

This view will take care of training homepage. It will show progress of the training if the user has already started the training, show them details of the training and allow them to start/resume and review the training.

2. training.views.take_module_training

This view will take care of letting users take individual modules of the training. It will allow users to take the module from where they left off.
Users will need to finish module1 before they can start module2 and so on.

Here we have used a considerable amount of javascript to make the training interactive. How it works is when the user loads the module page,
we initially load all the content, quizzes and order them based on the order field, and initially we hide all the content and quizzes.

Then we show either the first content,quiz or the next one after a content, quiz that they had completed last time. and we keep doing this until the user has completed the module.

3. training.views.update_module_progress

This view uses a simple post request and expects an ajax request from the client. It will update the progress of the module and the progress of the training.

Testing? [WIP]

Following tests will be added

  1. Check access to the training homepage
  2. Check access to the training module page
  3. Check valid and invalid submission of the training module
  4. Check valid and invalid submission of the training

Screenshots (optional)

image

image

image

image

Anything Else?

How to take a training as a user?

  1. Login as user
  2. Navigate to Settings
  3. Select the training from the dropdown
  4. Start the training

@amitupreti amitupreti marked this pull request as draft March 28, 2023 20:15
@amitupreti amitupreti force-pushed the au/training/feature/create_training_basics__implement_training_user branch from 3a7bb55 to 4bf486d Compare March 28, 2023 20:53
@amitupreti amitupreti force-pushed the au/training/feature/create_training_basics__implement_training_user branch 2 times, most recently from 7a3246d to 662d905 Compare March 29, 2023 15:36
@amitupreti
Copy link
Contributor Author

Quick Note: There is a weird bug i just noticed

Currently OnPlatform training is treated unique based on version_number and training_type. So if a user had taken a training with version 1.1, and then next month there is a minor update with version 1.2, their previous training would still be valid.

But if they go and they try to review the training again, they will be retaking the new version 1.2 of training.(because by default we always provide them with the latest version of training).

Which brings to the weird bug which is that if the user hadn't finished the training 1.1 and the version 1.2 was lunched, then when they try to resume the training, it will be like taking the training from scratch for them

1. Course

The idea is that a Training Course will be defined with user.TrainingType. This is the ultimate(top) model for a training course.
The Course content for TrainingType model is implemented by training app. On Training app, `Course` model
can be created for each TrainingType. For different versions of the same training course, we can create as many `Course`
models as we want as long as the version is different.

A Course is divided into modules. Each module has a description and a list of contents and quizzes. Modules are like
chapters in a book. Each module has a list of contents and quizzes. Contents are like paragraphs in a chapter. Quizzes are
like questions in a chapter.
for ordering the modules, contents and quizzes, we have used `order` field. This field is used to order the modules, contents and quizzes
The ordering is unique for each instance of the parent model. It is expected that the order will start from 1 and will be incremented by 1
with no gaps.

2. Tracking User Progress during training

When a user starts a training, a `CourseProgress` model should be created for that user and the version of course.
This model tracks the progress of the user during the course. Similarly, when a user starts a module, a ModuleProgress
model should be created for each module in the training. For quiz, content progress, we should create a instance of
 CompletedContent or CompletedQuiz model when the user completes a content or quiz.
I dont think we need to track when someone started a content or quiz as they are expected to complete in few minutes.
Added a serializer which will be used to allow admins to create a new
 training or update the existing training.

To track the updates to training(manage versions), we are using semantic versioning. If the updated course has a major update
eg: from 1.9 to 2.0, then all the users who did complete the previous
versions will be sent an email asking them to complete the new version
 of Course within x days.
@amitupreti amitupreti force-pushed the au/training/feature/create_training_basics__implement_training_user branch 5 times, most recently from 9e86701 to d4e396f Compare April 12, 2023 20:04
1. Added example json files to create and update a Course
training.
2. updated the fixtures to create permissions to create the Course training and an demo Course training.
allows admins to manage(create, update or download an existing course)
courses from the admin console
We also added a Course Guidelines under `Guidelines` in the admin
 console which explains the steps to create a course
@amitupreti amitupreti force-pushed the au/training/feature/create_training_basics__implement_training_user branch 2 times, most recently from 9c4f330 to 905f170 Compare April 13, 2023 21:44
@amitupreti amitupreti marked this pull request as ready for review April 13, 2023 21:46
@tompollard
Copy link
Member

tompollard commented Jun 26, 2023

I merged this PR on top of #1950 to do some testing. There were a few issues I came across while testing:

  1. Duplicate training:

Minor thing, but it is currently possible to upload duplicate training courses at:
http://localhost:8000/console/courses/

  1. Getting stuck after hitting "back"
  • Sign in and start a training course at: http://localhost:8000/settings/training/
  • Click "Start" to start the training
  • Click "Next" after reading the explanatory content on "The Americas"
  • Select a response to the first question, then click "Back"
  • "Next" is greyed out and cannot be clicked. You are stuck!
  1. Reloading the page after following point 2 above

Reloading the page after following the points above triggers the following error. Returning to http://localhost:8000/settings/platform-training/3/ and clicking "Continue" triggers the same error.

Request Method: GET
Request URL: http://localhost:8000/settings/platform-training/3/module/3/

Traceback (most recent call last):
  File "/Users/tompollard/projects/physionet-build/env/lib/python3.10/site-packages/django/core/handlers/exception.py", line 56, in inner
    response = get_response(request)
  File "/Users/tompollard/projects/physionet-build/env/lib/python3.10/site-packages/django/core/handlers/base.py", line 197, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/Users/tompollard/projects/physionet-build/env/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/Users/tompollard/projects/physionet-build/physionet-django/training/views.py", line 147, in take_module_training
    resume_content_or_quiz_object = resume_content_or_quiz_module.get_next_content_or_quiz()

Exception Type: AttributeError at /settings/platform-training/3/module/3/
Exception Value: 'ModuleProgress' object has no attribute 'get_next_content_or_quiz'
  1. Reviewing a completed course

After completing a course, returning to http://localhost:8000/settings/platform-training/3/ and clicking "Review" triggers the same Exception Value: 'ModuleProgress' object has no attribute 'get_next_content_or_quiz' error.

Rutvikrj26 and others added 2 commits July 6, 2023 15:12
Here users should be able to see their progress
and basic training details, modules, etc
@tompollard
Copy link
Member

Thanks for running through this today @Rutvikrj26. As discussed, please could you remove all javascript elements as far as possible? If dynamic features are needed, consider HTMX.

tompollard added a commit that referenced this pull request May 14, 2024
This adds test coverage for most of the URLs in the `project` app.

See the previous pull requests #1695, #1922, #2108 for background.

With this change, the bulk of site functionality should now be included
in the TestURLs framework. A few small apps are left to add:
- `oauth` (should be easy)
- `sso` (should be easy but I'm not sure this is enabled in test
configs)
- `training` (awaiting pull #1951)

And a number of URLs across the site are skipped due to a lack of
fixture data:
- `console`
  - `edit_submission`
  - `copyedit_submission`
  - `awaiting_authors`
  - `publish_submission`
  - `event_agreement_detail`
  - `event_agreement_delete`
  - `event_agreement_new_version`
- `project`
  - `serve_document`
  - `published_project_request_access`
- `search`
  - `redirect_challenge_project`
@Rutvikrj26
Copy link
Contributor

@bemoody I've updated the URL for the heading and the PR is ready for further review / merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants