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
64b117a7
Commit
64b117a7
authored
Oct 23, 2012
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed metric names, added into render page
parent
51f3b719
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
common/djangoapps/student/views.py
+12
-2
lms/djangoapps/courseware/module_render.py
+11
-0
No files found.
common/djangoapps/student/views.py
View file @
64b117a7
...
...
@@ -206,7 +206,10 @@ def change_enrollment(request):
return
{
'success'
:
False
,
'error'
:
'enrollment in {} not allowed at this time'
.
format
(
course
.
display_name
)}
statsd
.
increment
(
"lms.user.enrollment"
,
tags
=
[
"course:"
+
str
(
course_id
)])
split_course
=
course_id
.
split
(
"/"
)
statsd
.
increment
(
"lms.user.enrollment"
,
tags
=
[
"org:"
+
str
(
split_course
[
0
]),
"course:"
+
str
(
split_course
[
1
]),
"run:"
+
str
(
split_course
[
2
])])
enrollment
,
created
=
CourseEnrollment
.
objects
.
get_or_create
(
user
=
user
,
course_id
=
course
.
id
)
return
{
'success'
:
True
}
...
...
@@ -214,7 +217,10 @@ def change_enrollment(request):
try
:
enrollment
=
CourseEnrollment
.
objects
.
get
(
user
=
user
,
course_id
=
course_id
)
enrollment
.
delete
()
statsd
.
increment
(
"lms.user.unenrollment"
,
tags
=
[
"course:"
+
str
(
course_id
)])
split_course
=
course_id
.
split
(
"/"
)
statsd
.
increment
(
"lms.user.unenrollment"
,
tags
=
[
"org:"
+
str
(
split_course
[
0
]),
"course:"
+
str
(
split_course
[
1
]),
"run:"
+
str
(
split_course
[
2
])])
return
{
'success'
:
True
}
except
CourseEnrollment
.
DoesNotExist
:
return
{
'success'
:
False
,
'error'
:
'You are not enrolled for this course.'
}
...
...
@@ -263,7 +269,9 @@ def login_user(request, error=""):
log
.
info
(
"Login success - {0} ({1})"
.
format
(
username
,
email
))
try_change_enrollment
(
request
)
statsd
.
increment
(
"lms.user.successful_login"
)
return
HttpResponse
(
json
.
dumps
({
'success'
:
True
}))
log
.
warning
(
"Login failed - Account not active for user {0}, resending activation"
.
format
(
username
))
...
...
@@ -469,7 +477,9 @@ def create_account(request, post_override=None):
log
.
debug
(
'bypassing activation email'
)
login_user
.
is_active
=
True
login_user
.
save
()
statsd
.
increment
(
"lms.user.account_created"
)
js
=
{
'success'
:
True
}
return
HttpResponse
(
json
.
dumps
(
js
),
mimetype
=
"application/json"
)
...
...
lms/djangoapps/courseware/module_render.py
View file @
64b117a7
...
...
@@ -28,6 +28,8 @@ from xmodule.x_module import ModuleSystem
from
xmodule.error_module
import
ErrorDescriptor
,
NonStaffErrorDescriptor
from
xmodule_modifiers
import
replace_course_urls
,
replace_static_urls
,
add_histogram
,
wrap_xmodule
from
statsd
import
statsd
log
=
logging
.
getLogger
(
"mitx.courseware"
)
...
...
@@ -381,6 +383,10 @@ def xqueue_callback(request, course_id, userid, id, dispatch):
instance_module
.
grade
=
instance
.
get_score
()[
'score'
]
if
instance_module
.
grade
!=
oldgrade
or
instance_module
.
state
!=
old_instance_state
:
instance_module
.
save
()
course_split
=
course_id
.
split
(
"/"
)
if
(
instance_module
.
state
==
"correct"
or
instance_module
.
state
==
"incorrect"
):
statsd
.
increment
(
"lms.user.question_answered"
,
tags
=
[
"org:"
+
str
(
course_split
[
0
]),
"course:"
+
str
(
course_split
[
1
]),
"run:"
+
str
(
course_split
[
2
]),
"answer:"
+
str
(
instance_module
.
state
),
"score:"
+
str
(
instance_module
.
grade
),
"type:xqueue"
])
return
HttpResponse
(
""
)
...
...
@@ -465,6 +471,11 @@ def modx_dispatch(request, dispatch, location, course_id):
instance_module
.
state
!=
old_instance_state
or
instance_module
.
max_grade
!=
old_instance_max_grade
):
instance_module
.
save
()
course_split
=
course_id
.
split
(
"/"
)
if
(
instance_module
.
state
==
"correct"
or
instance_module
.
state
==
"incorrect"
):
statsd
.
increment
(
"lms.user.question_answered"
,
tags
=
[
"org:"
+
str
(
course_split
[
0
]),
"course:"
+
str
(
course_split
[
1
]),
"run:"
+
str
(
course_split
[
2
]),
"answer:"
+
str
(
instance_module
.
state
),
"score:"
+
str
(
instance_module
.
grade
),
"type:ajax"
])
if
shared_module
is
not
None
:
shared_module
.
state
=
instance
.
get_shared_state
()
...
...
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