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

fix: changing date time to date and applying general imrpovements #81

Merged
merged 1 commit into from
Aug 9, 2023

Conversation

andrey-canon
Copy link
Collaborator

Description

Changes dateTime to date
Considers all the 2xx status codes
Improves response error logs

# Certificate doesn't have an expiration date, so this is a thing that the client must define.
"expiration_date": timestamp + timezone.timedelta(days=365),
"expiration_date": time + timezone.timedelta(days=365),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This in future would be manage via settings?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Or that depend on course finish?

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 removed that in last commit based on the slack comments https://futurexlms.slack.com/archives/C04Q5CSKA8N/p1691590631770909

@@ -40,12 +40,13 @@ def _generate_external_certificate_data(timestamp, certificate_data):
group_codes = getattr(settings, "EXTERNAL_CERTIFICATES_GROUP_CODES", {})
course_id = str(certificate_data.course.course_key)
extra_info = getattr(user, "extrainfo", None)
time = timestamp.date()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Time wasnt defined xD??

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok no it comes from it call as an arg.

Copy link
Collaborator

Choose a reason for hiding this comment

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

What is timestamp? isnt a float???

image
Or which type it is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

timestamp renamed to time

@@ -53,13 +52,14 @@ def make_post(self, path, data):

response = self.session.post(url=url, json=data)

if response.status_code == status.HTTP_200_OK:
if response.ok:
Copy link
Collaborator

Choose a reason for hiding this comment

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

I like this change, status less than 400. So different types of 200, up 300...

"id": user["national_id"],
"id_type": "saudi",
},
"group_code": certificate_data["group_code"],
"certificate_type": "completion", # What types do we have ?
"metadata": {
"degree": certificate_data["grade"],
"FAIL": certificate_data["is_passing"],
"FAIL": not certificate_data["is_passing"],
Copy link
Collaborator

@johanseto johanseto Aug 9, 2023

Choose a reason for hiding this comment

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

Ok that not has lot of logic

@@ -44,7 +44,7 @@ def _generate_external_certificate_data(time, certificate_data):
"id": certificate.id,
"created_at": time.date(),
"expiration_date": None,
"grade": int(certificate_data.grade),
"grade": float(certificate_data.grade) * 100,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Does certificates receive float ? or This have to be int? Or could be float like 87.8?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This field was set a CharField, and the current prod implementation shows values between 0 and 1 where 1 is 100% and 0 is 0% so there are values like 0.85

@johanseto johanseto self-requested a review August 9, 2023 19:17
@andrey-canon andrey-canon merged commit 7e9629b into master Aug 9, 2023
6 checks passed
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