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
cb77b9d3
Commit
cb77b9d3
authored
Jan 26, 2012
by
David Ormsbee
Browse files
Options
Browse Files
Download
Plain Diff
merge logging changes
parents
cf210ea1
fd8b1e50
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
16 deletions
+34
-16
courseware/module_render.py
+1
-8
courseware/modules/x_module.py
+5
-0
courseware/progress.py
+25
-6
courseware/views.py
+1
-0
settings.py
+2
-2
No files found.
courseware/module_render.py
View file @
cb77b9d3
...
...
@@ -111,13 +111,6 @@ def render_x_module(user, request, xml_module, module_object_preload):
user
,
module_type
,
module_id
)
# s = StudentModule.objects.filter(student=request.user,
# module_id=module_id,
# module_type = module_type)
# if len(s) == 0:
# s=None
# else:
# s=s[0]
if
s
==
None
:
# If nothing in the database...
state
=
None
...
...
@@ -132,7 +125,7 @@ def render_x_module(user, request, xml_module, module_object_preload):
ajax_url
=
ajax_url
,
state
=
state
,
track_function
=
make_track_function
(
request
),
render_function
=
lambda
x
:
render_module
(
user
,
request
,
x
,
module_object_preload
))
render_function
=
lambda
x
:
render_module
(
user
,
request
,
x
,
module_object_preload
))
# If instance wasn't already in the database, create it
if
s
==
None
:
...
...
courseware/modules/x_module.py
View file @
cb77b9d3
import
courseware.progress
def
dummy_track
(
event_type
,
event
):
pass
...
...
@@ -12,6 +14,9 @@ class XModule(object):
''' Tags in the courseware file guaranteed to correspond to the module '''
return
[]
def
get_completion
(
self
):
return
courseware
.
progress
.
completion
()
def
get_state
(
self
):
return
""
...
...
courseware/progress.py
View file @
cb77b9d3
class
completion
(
object
):
def
__init__
(
self
,
d
=
None
):
self
.
dict
=
dict
()
def
__init__
(
self
,
**
d
):
self
.
dict
=
dict
({
'duration_total'
:
0
,
'duration_watched'
:
0
,
'done'
:
True
,
'questions_correct'
:
0
,
'questions_incorrect'
:
0
,
'questions_total'
:
0
})
if
d
:
self
.
dict
.
update
(
d
)
...
...
@@ -11,9 +16,23 @@ class completion(object):
self
.
dict
[
key
]
=
value
def
__add__
(
self
,
other
):
result
=
dict
()
dict
.
update
(
self
.
dict
)
dict
.
update
(
other
.
dict
)
result
=
dict
(
self
.
dict
)
for
item
in
[
'duration_total'
,
'duration_watched'
,
'done'
,
'questions_correct'
,
'questions_incorrect'
,
'questions_total'
]:
result
[
item
]
=
result
[
item
]
+
other
.
dict
[
item
]
return
completion
(
**
result
)
def
__contains__
(
self
,
key
):
pass
return
key
in
dict
def
__repr__
(
self
):
return
repr
(
self
.
dict
)
if
__name__
==
'__main__'
:
dict1
=
completion
(
duration_total
=
5
)
dict2
=
completion
(
duration_total
=
7
)
print
dict1
+
dict2
courseware/views.py
View file @
cb77b9d3
...
...
@@ -134,6 +134,7 @@ def index(request, course="6.002 Spring 2012", chapter="Using the System", secti
module_object_preload
=
list
(
StudentModule
.
objects
.
filter
(
student
=
user
,
module_id__in
=
module_ids
))
module
=
render_module
(
user
,
request
,
module
,
module_object_preload
)
...
...
settings.py
View file @
cb77b9d3
settings_old_askbot
.
py
\ No newline at end of file
settings_new_askbot
.
py
\ No newline at end of file
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