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

feat: add candidate field to RTEN model #190

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

andrey-canon
Copy link
Collaborator

Description

This adds a new User field to the RTEN model so that the record is associated with a User record in the database. This includes the required view modifications

Testing instructions

  1. Run migrations ./manage.py lms migrate eox_nelp
  2. set the setting ENABLE_CERTIFICATE_PUBLISHER, this will enable the result notification pipeline and the external certificate publisher, its not necessary to test the external call so you can use an invalid mode, or if you want to test the external call set CERTIFICATE_PUBLISHER_VALID_MODES with the desired mode
  3. Make a postman call with the following data
{
   "eventType":"RESULT_AVAILABLE",
   "eventTime":"?",
   "candidate":{
      "candidateName":{
         "firstName":"Maximo",
         "lastName":"Tercero"
      },
      "email":"?",
      "lastUpdate":"?",
      "vueCandidateID":"?",
      "clientCandidateID":"?"
   },
   "attempt":"$",
   "exams":{
      "exam":[
         {
            "examDefinition":{
               "examSeriesCode":"?",
               "examLanguageCode":"?",
               "examName":"?",
               "deliveryModel":"?",
               "vueExamVersionId":"?",
               "vueExamRevisionID":"?",
               "clientExamVersionId":"?",
               "examForm":"?",
               "isBetaVersion":"#"
            },
            "examResult":{
               "outcomeType":"?",
               "startTime":"?",
               "timeUsed":"$",
               "passingScore":"0.8",
               "score":"0.832",
               "rawScore":"$",
               "grade":"0.5",
               "correct":"$",
               "incorrect":"$",
               "skipped":"$",
               "unscored":"$"
            },
            "noShow":"#",
            "expired":"#",
            "ndaRefused":"#",
            "deliveryEventType":"?"
         }
      ]
   },
   "vueAppointmentID":"$",
   "clientCode":"?",
   "vueCandidateID":"$",
   "clientCandidateID":"?" /// Complete this
}
  1. Check in admin panel

Before

image

After

image

Additional information

Include anything else that will help reviewers and consumers understand the change.

  • Does this change depend on other changes elsewhere?
  • Any special concerns or limitations? For example: deprecations, migrations, security, or accessibility.
  • Link to other information about the change, such as Jira issues, GitHub issues, or Discourse discussions.

Checklist for Merge

  • Tested in a remote environment
  • Updated documentation
  • Rebased master/main
  • Squashed commits

@@ -47,3 +49,4 @@ class PearsonRTENEvent(models.Model):
content = models.JSONField()
created_at = models.DateTimeField(auto_now_add=True)
event_type = models.CharField(max_length=20, choices=EVENT_TYPE_CHOICES)
candidate = models.ForeignKey(User, null=True, on_delete=models.SET_NULL)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think we could use blank=True, in order to don't be mandatory in forms or serializer.?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to do this as mandatory as possible since the idea is that every record has a user however we don't know if the client will send the whole data in the example format and secondly the migration process complains about previous records when the null=True field is not present, that's why I added the null field and I don't think we should include the blank field

Returns:
user (object or None): The user object associated with the anonymous user ID, or `None` if not found.
"""
anonymous_user_id = self.request.data.get("clientCandidateID", "").replace("NELC", "")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, we'd avoid modifying clientCandidateId(product requirement?) due to its impact on product functionality and user experience. Any changes would necessitate significant code updates related to anonymous IDs.

Copy link
Collaborator

@johanseto johanseto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and working in my local env.
2024-07-08_15-12

@andrey-canon andrey-canon merged commit 115e025 into master Jul 8, 2024
7 checks passed
@andrey-canon andrey-canon deleted the and/add_candidate_field branch July 16, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants