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
837b9c90
Commit
837b9c90
authored
Mar 10, 2012
by
Piotr Mitros
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic gradebook
parent
af815abe
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
15 deletions
+32
-15
courseware/grades.py
+6
-13
courseware/views.py
+25
-2
urls.py
+1
-0
No files found.
courseware/grades.py
View file @
837b9c90
import
logging
import
urllib
from
lxml
import
etree
import
courseware.content_parser
as
content_parser
from
models
import
StudentModule
from
django.conf
import
settings
import
courseware.modules
from
student.models
import
UserProfile
...
...
@@ -41,7 +43,7 @@ def get_grade(user, problem, cache):
return
(
correct
,
total
)
def
gradesheet
(
student
):
def
grade
_
sheet
(
student
):
dom
=
content_parser
.
course_file
(
student
)
course
=
dom
.
xpath
(
'//course/@name'
)[
0
]
xmlChapters
=
dom
.
xpath
(
'//course[@name=$course]/chapter'
,
course
=
course
)
...
...
@@ -220,16 +222,7 @@ def gradesheet(student):
}
]
return
{
'grade_summary'
:
grade_summary
,
'chapters'
:
chapters
}
user_info
=
UserProfile
.
objects
.
get
(
user
=
student
)
# request.user.profile_cache #
context
=
{
'name'
:
user_info
.
name
,
'username'
:
student
.
username
,
'location'
:
user_info
.
location
,
'language'
:
user_info
.
language
,
'email'
:
student
.
email
,
'chapters'
:
chapters
,
'format_url_params'
:
content_parser
.
format_url_params
,
'grade_summary'
:
grade_summary
,
}
return
context
courseware/views.py
View file @
837b9c90
...
...
@@ -37,6 +37,20 @@ etree.set_default_parser(etree.XMLParser(dtd_validation=False, load_dtd=False,
template_imports
=
{
'urllib'
:
urllib
}
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
gradebook
(
request
):
if
'course_admin'
not
in
content_parser
.
user_groups
(
request
.
user
):
raise
Http404
student_objects
=
User
.
objects
.
all
()[:
100
]
student_info
=
[{
'username'
:
s
.
username
,
'id'
:
s
.
id
,
'email'
:
s
.
email
,
'grade_info'
:
grades
.
grade_sheet
(
s
),
'realname'
:
UserProfile
.
objects
.
get
(
user
=
s
)
.
name
}
for
s
in
student_objects
]
return
render_to_response
(
'gradebook.html'
,{
'students'
:
student_info
})
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
def
profile
(
request
,
student_id
=
None
):
''' User profile. Show username, location, etc, as well as grades .
We need to allow the user to change some of these settings .'''
...
...
@@ -51,8 +65,17 @@ def profile(request, student_id = None):
raise
Http404
student
=
User
.
objects
.
get
(
id
=
int
(
student_id
))
context
=
grades
.
gradesheet
(
student
)
context
.
update
({
'csrf'
:
csrf
(
request
)[
'csrf_token'
]})
user_info
=
UserProfile
.
objects
.
get
(
user
=
student
)
# request.user.profile_cache #
context
=
{
'name'
:
user_info
.
name
,
'username'
:
student
.
username
,
'location'
:
user_info
.
location
,
'language'
:
user_info
.
language
,
'email'
:
student
.
email
,
'format_url_params'
:
content_parser
.
format_url_params
,
'csrf'
:
csrf
(
request
)[
'csrf_token'
]
}
context
.
update
(
grades
.
grade_sheet
(
student
))
return
render_to_response
(
'profile.html'
,
context
)
...
...
urls.py
View file @
837b9c90
...
...
@@ -8,6 +8,7 @@ import django.contrib.auth.views
# admin.autodiscover()
urlpatterns
=
(
''
,
url
(
r'^gradebook$'
,
'courseware.views.gradebook'
),
url
(
r'^event$'
,
'track.views.user_track'
),
url
(
r'^t/(?P<template>[^/]*)$'
,
'static_template_view.views.index'
),
url
(
r'^logout$'
,
'student.views.logout_user'
),
...
...
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