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
100e6980
Commit
100e6980
authored
Jul 09, 2014
by
Justin Riley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use student.roles instead of get_user_role
parent
5cc89a38
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
10 deletions
+12
-10
lms/djangoapps/courseware/management/commands/attempt_stats.py
+12
-10
No files found.
lms/djangoapps/courseware/management/commands/attempt_stats.py
View file @
100e6980
...
@@ -13,18 +13,17 @@ import csv
...
@@ -13,18 +13,17 @@ import csv
import
json
import
json
from
optparse
import
make_option
from
optparse
import
make_option
from
request_cache.middleware
import
RequestCache
from
xmodule.modulestore.django
import
modulestore
from
courseware.access
import
get_user_role
from
courseware.module_tree_reset
import
ProctorModuleInfo
from
courseware.models
import
StudentModule
,
StudentModuleHistory
from
django.conf
import
settings
from
django.conf
import
settings
from
django.dispatch
import
Signal
from
django.dispatch
import
Signal
from
django.core.cache
import
get_cache
from
django.core.cache
import
get_cache
from
django.contrib.auth.models
import
User
from
django.core.management.base
import
BaseCommand
,
CommandError
from
django.core.management.base
import
BaseCommand
,
CommandError
from
student
import
roles
from
request_cache.middleware
import
RequestCache
from
xmodule.modulestore.django
import
modulestore
from
courseware.module_tree_reset
import
ProctorModuleInfo
from
courseware.models
import
StudentModule
,
StudentModuleHistory
CACHE
=
get_cache
(
'mongo_metadata_inheritance'
)
CACHE
=
get_cache
(
'mongo_metadata_inheritance'
)
for
store_name
in
settings
.
MODULESTORE
:
for
store_name
in
settings
.
MODULESTORE
:
...
@@ -69,11 +68,14 @@ def update_stats(sm, stat, history=False):
...
@@ -69,11 +68,14 @@ def update_stats(sm, stat, history=False):
return
"attempted"
return
"attempted"
def
compute_stats
(
course_id
,
csv_file
=
None
):
def
compute_stats
(
course_id
):
pminfo
=
ProctorModuleInfo
(
course_id
)
pminfo
=
ProctorModuleInfo
(
course_id
)
all_problems
=
[]
all_problems
=
[]
stats
=
[]
stats
=
[]
staffgroup
=
get_user_role
(
User
.
objects
.
get
(
username
=
'staff'
),
pminfo
.
course
.
id
)
course_url
=
pminfo
.
course
.
location
.
url
()
staff_role
=
roles
.
CourseStaffRole
(
course_url
)
inst_role
=
roles
.
CourseInstructorRole
(
course_url
)
exclude_groups
=
staff_role
.
_group_names
+
inst_role
.
_group_names
for
rpmod
in
pminfo
.
rpmods
:
for
rpmod
in
pminfo
.
rpmods
:
assignment_set_name
=
rpmod
.
ra_ps
.
display_name
assignment_set_name
=
rpmod
.
ra_ps
.
display_name
...
@@ -86,7 +88,7 @@ def compute_stats(course_id, csv_file=None):
...
@@ -86,7 +88,7 @@ def compute_stats(course_id, csv_file=None):
stat
=
Stats
()
stat
=
Stats
()
smset0
=
StudentModule
.
objects
.
filter
(
module_state_key
=
problem
.
id
,
smset0
=
StudentModule
.
objects
.
filter
(
module_state_key
=
problem
.
id
,
student__is_staff
=
False
)
student__is_staff
=
False
)
smset
=
smset0
.
exclude
(
student__groups__name__i
contains
=
staffgroup
)
smset
=
smset0
.
exclude
(
student__groups__name__i
n
=
exclude_groups
)
for
sm
in
smset
:
for
sm
in
smset
:
stat
.
nassigned
+=
1
stat
.
nassigned
+=
1
ret
=
update_stats
(
sm
,
stat
)
ret
=
update_stats
(
sm
,
stat
)
...
...
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