Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-proctoring
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
OpenEdx
edx-proctoring
Commits
c7bb88a1
Commit
c7bb88a1
authored
Jul 07, 2015
by
Muhammad Shoaib
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added the collection for the allowances data.
parent
1712b42b
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
82 additions
and
16 deletions
+82
-16
edx_proctoring/api.py
+8
-0
edx_proctoring/models.py
+7
-0
edx_proctoring/static/proctoring/js/proctored_app.js
+4
-2
edx_proctoring/static/proctoring/js/proctored_exam_allowance_collection.js
+14
-0
edx_proctoring/static/proctoring/js/proctored_exam_allowance_model.js
+10
-3
edx_proctoring/static/proctoring/js/proctored_exam_allowance_view.js
+24
-9
edx_proctoring/urls.py
+5
-0
edx_proctoring/views.py
+10
-2
No files found.
edx_proctoring/api.py
View file @
c7bb88a1
...
@@ -135,6 +135,14 @@ def add_allowance_for_user(exam_id, user_id, key, value):
...
@@ -135,6 +135,14 @@ def add_allowance_for_user(exam_id, user_id, key, value):
ProctoredExamStudentAllowance
.
add_allowance_for_user
(
exam_id
,
user_id
,
key
,
value
)
ProctoredExamStudentAllowance
.
add_allowance_for_user
(
exam_id
,
user_id
,
key
,
value
)
def
get_allowances_for_course
(
course_id
):
"""
Get all the allowances for the course.
"""
student_allowances
=
ProctoredExamStudentAllowance
.
get_allowances_for_course
(
course_id
)
return
[
ProctoredExamStudentAllowanceSerializer
(
allowance
)
.
data
for
allowance
in
student_allowances
]
def
remove_allowance_for_user
(
exam_id
,
user_id
,
key
):
def
remove_allowance_for_user
(
exam_id
,
user_id
,
key
):
"""
"""
Deletes an allowance for a user within a given exam.
Deletes an allowance for a user within a given exam.
...
...
edx_proctoring/models.py
View file @
c7bb88a1
...
@@ -201,6 +201,13 @@ class ProctoredExamStudentAllowance(TimeStampedModel):
...
@@ -201,6 +201,13 @@ class ProctoredExamStudentAllowance(TimeStampedModel):
verbose_name
=
'proctored allowance'
verbose_name
=
'proctored allowance'
@classmethod
@classmethod
def
get_allowances_for_course
(
cls
,
course_id
):
"""
Returns all the allowances for a course.
"""
return
cls
.
objects
.
filter
(
proctored_exam__course_id
=
course_id
)
@classmethod
def
get_allowance_for_user
(
cls
,
exam_id
,
user_id
,
key
):
def
get_allowance_for_user
(
cls
,
exam_id
,
user_id
,
key
):
"""
"""
Returns an allowance for a user within a given exam
Returns an allowance for a user within a given exam
...
...
edx_proctoring/static/proctoring/js/proctored_app.js
View file @
c7bb88a1
...
@@ -6,9 +6,11 @@ $(function() {
...
@@ -6,9 +6,11 @@ $(function() {
});
});
proctored_exam_view
.
render
();
proctored_exam_view
.
render
();
var
container
=
$
(
".special-allowance-container"
);
var
course_id
=
container
.
data
(
'course-id'
);
var
proctored_exam_allowance_view
=
new
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
({
var
proctored_exam_allowance_view
=
new
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
({
el
:
$
(
".special-allowance-container"
)
,
el
:
container
,
allowance_template_url
:
'/static/proctoring/templates/add-allowance.underscore'
,
allowance_template_url
:
'/static/proctoring/templates/add-allowance.underscore'
,
model
:
new
ProctoredExamAllowanceModel
()
course_id
:
course_id
});
});
});
});
edx_proctoring/static/proctoring/js/proctored_exam_allowance_collection.js
0 → 100644
View file @
c7bb88a1
var
edx
=
edx
||
{};
(
function
(
Backbone
)
{
edx
.
instructor_dashboard
=
edx
.
instructor_dashboard
||
{};
edx
.
instructor_dashboard
.
proctoring
=
edx
.
instructor_dashboard
.
proctoring
||
{};
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceCollection
=
Backbone
.
Collection
.
extend
({
/* model for a collection of ProctoredExamAllowance */
model
:
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
,
url
:
'/api/edx_proctoring/v1/proctored_exam/allowance'
});
this
.
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceCollection
=
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceCollection
;
}).
call
(
this
,
Backbone
);
\ No newline at end of file
edx_proctoring/static/proctoring/js/proctored_exam_allowance_model.js
View file @
c7bb88a1
var
edx
=
edx
||
{};
(
function
(
Backbone
)
{
(
function
(
Backbone
)
{
var
ProctoredExamAllowanceModel
=
Backbone
.
Model
.
extend
({
'use strict'
;
edx
.
instructor_dashboard
=
edx
.
instructor_dashboard
||
{};
edx
.
instructor_dashboard
.
proctoring
=
edx
.
instructor_dashboard
.
proctoring
||
{};
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
=
Backbone
.
Model
.
extend
({
/* we should probably pull this from a data attribute on the HTML */
/* we should probably pull this from a data attribute on the HTML */
url
:
'/api/edx_proctoring/v1/proctored_exam/allowance'
,
url
:
'/api/edx_proctoring/v1/proctored_exam/allowance'
,
...
@@ -7,6 +15,5 @@
...
@@ -7,6 +15,5 @@
}
}
});
});
this
.
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
=
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceModel
;
this
.
ProctoredExamAllowanceModel
=
ProctoredExamAllowanceModel
;
}).
call
(
this
,
Backbone
);
}).
call
(
this
,
Backbone
);
edx_proctoring/static/proctoring/js/proctored_exam_allowance_view.js
View file @
c7bb88a1
...
@@ -4,23 +4,26 @@ var edx = edx || {};
...
@@ -4,23 +4,26 @@ var edx = edx || {};
'use strict'
;
'use strict'
;
edx
.
instructor_dashboard
=
edx
.
instructor_dashboard
||
{};
edx
.
instructor_dashboard
=
edx
.
instructor_dashboard
||
{};
edx
.
instructor_dashboard
.
proctoring
=
{};
edx
.
instructor_dashboard
.
proctoring
=
edx
.
instructor_dashboard
.
proctoring
||
{};
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
=
Backbone
.
View
.
extend
({
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
=
Backbone
.
View
.
extend
({
initialize
:
function
(
options
)
{
initialize
:
function
(
options
)
{
this
.
$el
=
options
.
el
;
this
.
$el
=
options
.
el
;
this
.
model
=
options
.
model
;
this
.
collection
=
new
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceCollection
();
this
.
course_id
=
options
.
course_id
;
this
.
temPlateUrl
=
options
.
allowance_template_url
;
this
.
temPlateUrl
=
options
.
allowance_template_url
;
this
.
template
=
null
;
this
.
template
=
null
;
/* re-render if the model changes */
/* re-render if the model changes */
this
.
listenTo
(
this
.
model
,
'change'
,
this
.
model
Changed
);
this
.
listenTo
(
this
.
collection
,
'change'
,
this
.
collection
Changed
);
/* make the async call to the backend REST API */
/* make the async call to the backend REST API */
/* after it loads, the listenTo event will file and */
/* after it loads, the listenTo event will file and */
/* will call into the rendering */
/* will call into the rendering */
//this.model.fetch();
this
.
loadTemplateData
();
this
.
loadTemplateData
();
this
.
collection
.
url
=
this
.
collection
.
url
+
'/'
+
this
.
course_id
;
},
},
loadTemplateData
:
function
(){
loadTemplateData
:
function
(){
var
self
=
this
;
var
self
=
this
;
...
@@ -30,19 +33,31 @@ var edx = edx || {};
...
@@ -30,19 +33,31 @@ var edx = edx || {};
})
})
.
done
(
function
(
template_data
)
{
.
done
(
function
(
template_data
)
{
self
.
template
=
_
.
template
(
template_data
);
self
.
template
=
_
.
template
(
template_data
);
self
.
render
()
self
.
hydrate
();
});
},
hydrate
:
function
()
{
/* This function will load the bound collection */
/* add and remove a class when we do the initial loading */
/* we might - at some point - add a visual element to the */
/* loading, like a spinner */
var
self
=
this
;
this
.
collection
.
fetch
({
success
:
function
(){
self
.
render
();
}
});
});
},
},
model
Changed
:
function
()
{
collection
Changed
:
function
()
{
//this.render
();
this
.
hydrate
();
},
},
render
:
function
()
{
render
:
function
()
{
if
(
this
.
template
!==
null
)
{
if
(
this
.
template
!==
null
)
{
var
html
=
this
.
template
();
var
html
=
this
.
template
(
this
.
collection
.
toJSON
()
);
this
.
$el
.
html
(
html
);
this
.
$el
.
html
(
html
);
this
.
$el
.
show
();
this
.
$el
.
show
();
}
}
return
this
;
}
}
});
});
this
.
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
=
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
;
this
.
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
=
edx
.
instructor_dashboard
.
proctoring
.
ProctoredExamAllowanceView
;
...
...
edx_proctoring/urls.py
View file @
c7bb88a1
...
@@ -30,6 +30,11 @@ urlpatterns = patterns( # pylint: disable=invalid-name
...
@@ -30,6 +30,11 @@ urlpatterns = patterns( # pylint: disable=invalid-name
name
=
'edx_proctoring.proctored_exam.attempt'
name
=
'edx_proctoring.proctored_exam.attempt'
),
),
url
(
url
(
r'edx_proctoring/v1/proctored_exam/allowance/{}$'
.
format
(
settings
.
COURSE_ID_PATTERN
),
views
.
ExamAllowanceView
.
as_view
(),
name
=
'edx_proctoring.proctored_exam.allowance'
),
url
(
r'edx_proctoring/v1/proctored_exam/allowance$'
,
r'edx_proctoring/v1/proctored_exam/allowance$'
,
views
.
ExamAllowanceView
.
as_view
(),
views
.
ExamAllowanceView
.
as_view
(),
name
=
'edx_proctoring.proctored_exam.allowance'
name
=
'edx_proctoring.proctored_exam.allowance'
...
...
edx_proctoring/views.py
View file @
c7bb88a1
...
@@ -20,8 +20,8 @@ from edx_proctoring.api import (
...
@@ -20,8 +20,8 @@ from edx_proctoring.api import (
add_allowance_for_user
,
add_allowance_for_user
,
remove_allowance_for_user
,
remove_allowance_for_user
,
get_active_exams_for_user
,
get_active_exams_for_user
,
create_exam_attempt
create_exam_attempt
,
)
get_allowances_for_course
)
from
edx_proctoring.exceptions
import
(
from
edx_proctoring.exceptions
import
(
ProctoredBaseException
,
ProctoredBaseException
,
ProctoredExamNotFoundException
,
ProctoredExamNotFoundException
,
...
@@ -358,6 +358,14 @@ class ExamAllowanceView(AuthenticatedAPIView):
...
@@ -358,6 +358,14 @@ class ExamAllowanceView(AuthenticatedAPIView):
**Response Values**
**Response Values**
* returns Nothing. deletes the allowance for the user proctored exam.
* returns Nothing. deletes the allowance for the user proctored exam.
"""
"""
def
get
(
self
,
request
,
course_id
):
"""
HTTP GET handler. Get all allowances for a course.
"""
return
Response
(
get_allowances_for_course
(
course_id
=
course_id
))
@method_decorator
(
require_staff
)
@method_decorator
(
require_staff
)
def
put
(
self
,
request
):
def
put
(
self
,
request
):
"""
"""
...
...
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