Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
d06edc68
Commit
d06edc68
authored
Feb 08, 2016
by
Hasnain
Committed by
hasnain-naveed
Feb 11, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added two fields in credit API
parent
a26d5764
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
3 deletions
+19
-3
openedx/core/djangoapps/credit/api/provider.py
+15
-1
openedx/core/djangoapps/credit/tests/test_api.py
+3
-1
requirements/edx/github.txt
+1
-1
No files found.
openedx/core/djangoapps/credit/api/provider.py
View file @
d06edc68
...
@@ -10,6 +10,7 @@ import pytz
...
@@ -10,6 +10,7 @@ import pytz
from
django.db
import
transaction
from
django.db
import
transaction
from
lms.djangoapps.django_comment_client.utils
import
JsonResponse
from
lms.djangoapps.django_comment_client.utils
import
JsonResponse
from
edx_proctoring.api
import
get_last_exam_completion_date
from
openedx.core.djangoapps.credit.exceptions
import
(
from
openedx.core.djangoapps.credit.exceptions
import
(
UserIsNotEligible
,
UserIsNotEligible
,
CreditProviderNotConfigured
,
CreditProviderNotConfigured
,
...
@@ -23,8 +24,12 @@ from openedx.core.djangoapps.credit.models import (
...
@@ -23,8 +24,12 @@ from openedx.core.djangoapps.credit.models import (
CreditRequest
,
CreditRequest
,
CreditEligibility
,
CreditEligibility
,
)
)
from
student.models
import
(
User
,
CourseEnrollment
,
)
from
openedx.core.djangoapps.credit.signature
import
signature
,
get_shared_secret_key
from
openedx.core.djangoapps.credit.signature
import
signature
,
get_shared_secret_key
from
student.models
import
User
from
util.date_utils
import
to_timestamp
from
util.date_utils
import
to_timestamp
...
@@ -264,12 +269,21 @@ def create_credit_request(course_key, provider_id, username):
...
@@ -264,12 +269,21 @@ def create_credit_request(course_key, provider_id, username):
log
.
exception
(
msg
)
log
.
exception
(
msg
)
raise
UserIsNotEligible
(
msg
)
raise
UserIsNotEligible
(
msg
)
# Getting the students's enrollment date
course_enrollment
=
CourseEnrollment
.
get_enrollment
(
user
,
course_key
)
enrollment_date
=
course_enrollment
.
created
if
course_enrollment
else
""
# Getting the student's course completion date
completion_date
=
get_last_exam_completion_date
(
course_key
,
username
)
parameters
=
{
parameters
=
{
"request_uuid"
:
credit_request
.
uuid
,
"request_uuid"
:
credit_request
.
uuid
,
"timestamp"
:
to_timestamp
(
datetime
.
datetime
.
now
(
pytz
.
UTC
)),
"timestamp"
:
to_timestamp
(
datetime
.
datetime
.
now
(
pytz
.
UTC
)),
"course_org"
:
course_key
.
org
,
"course_org"
:
course_key
.
org
,
"course_num"
:
course_key
.
course
,
"course_num"
:
course_key
.
course
,
"course_run"
:
course_key
.
run
,
"course_run"
:
course_key
.
run
,
"enrollment_timestamp"
:
to_timestamp
(
enrollment_date
)
if
enrollment_date
else
""
,
"course_completion_timestamp"
:
to_timestamp
(
completion_date
)
if
completion_date
else
""
,
"final_grade"
:
final_grade
,
"final_grade"
:
final_grade
,
"user_username"
:
user
.
username
,
"user_username"
:
user
.
username
,
"user_email"
:
user
.
email
,
"user_email"
:
user
.
email
,
...
...
openedx/core/djangoapps/credit/tests/test_api.py
View file @
d06edc68
...
@@ -720,10 +720,12 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
...
@@ -720,10 +720,12 @@ class CreditProviderIntegrationApiTests(CreditApiTestBase):
# - 2 queries: Get-or-create the credit request.
# - 2 queries: Get-or-create the credit request.
# - 1 query: Retrieve user account and profile information from the user API.
# - 1 query: Retrieve user account and profile information from the user API.
# - 1 query: Look up the user's final grade from the credit requirements table.
# - 1 query: Look up the user's final grade from the credit requirements table.
# - 1 query: Look up the user's enrollment date in the course.
# - 2 query: Look up the user's completion date in the course.
# - 1 query: Update the request.
# - 1 query: Update the request.
# - 2 queries: Update the history table for the request.
# - 2 queries: Update the history table for the request.
# - 4 Django savepoints
# - 4 Django savepoints
with
self
.
assertNumQueries
(
1
3
):
with
self
.
assertNumQueries
(
1
6
):
request
=
api
.
create_credit_request
(
self
.
course_key
,
self
.
PROVIDER_ID
,
self
.
USER_INFO
[
'username'
])
request
=
api
.
create_credit_request
(
self
.
course_key
,
self
.
PROVIDER_ID
,
self
.
USER_INFO
[
'username'
])
# - 2 queries: Retrieve and update the request
# - 2 queries: Retrieve and update the request
...
...
requirements/edx/github.txt
View file @
d06edc68
...
@@ -91,7 +91,7 @@ git+https://github.com/edx/xblock-utils.git@v1.0.2#egg=xblock-utils==1.0.2
...
@@ -91,7 +91,7 @@ git+https://github.com/edx/xblock-utils.git@v1.0.2#egg=xblock-utils==1.0.2
-e git+https://github.com/edx-solutions/xblock-google-drive.git@138e6fa0bf3a2013e904a085b9fed77dab7f3f21#egg=xblock-google-drive
-e git+https://github.com/edx-solutions/xblock-google-drive.git@138e6fa0bf3a2013e904a085b9fed77dab7f3f21#egg=xblock-google-drive
-e git+https://github.com/edx/edx-reverification-block.git@0.0.5#egg=edx-reverification-block==0.0.5
-e git+https://github.com/edx/edx-reverification-block.git@0.0.5#egg=edx-reverification-block==0.0.5
git+https://github.com/edx/edx-user-state-client.git@1.0.1#egg=edx-user-state-client==1.0.1
git+https://github.com/edx/edx-user-state-client.git@1.0.1#egg=edx-user-state-client==1.0.1
git+https://github.com/edx/edx-proctoring.git@0.12.
8#egg=edx-proctoring==0.12.8
git+https://github.com/edx/edx-proctoring.git@0.12.
9#egg=edx-proctoring==0.12.9
git+https://github.com/edx/xblock-lti-consumer.git@v1.0.3#egg=xblock-lti-consumer==1.0.3
git+https://github.com/edx/xblock-lti-consumer.git@v1.0.3#egg=xblock-lti-consumer==1.0.3
# Third Party XBlocks
# Third Party XBlocks
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment