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
OpenEdx
edx-platform
Commits
e98a9c79
Commit
e98a9c79
authored
Sep 08, 2017
by
Dillon Dumesnil
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v0.5
parent
8d89bdaa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
0 deletions
+79
-0
common/lib/xmodule/xmodule/html_module.py
+12
-0
common/lib/xmodule/xmodule/templates/html/dillon_iframe.yaml
+20
-0
lms/djangoapps/review/__init__.py
+3
-0
lms/djangoapps/review/get_review_ids.py
+44
-0
No files found.
common/lib/xmodule/xmodule/html_module.py
View file @
e98a9c79
...
@@ -24,6 +24,8 @@ from xmodule.util.misc import escape_html_characters
...
@@ -24,6 +24,8 @@ from xmodule.util.misc import escape_html_characters
from
xmodule.x_module
import
DEPRECATION_VSCOMPAT_EVENT
,
XModule
from
xmodule.x_module
import
DEPRECATION_VSCOMPAT_EVENT
,
XModule
from
xmodule.xml_module
import
XmlDescriptor
,
name_to_pathname
from
xmodule.xml_module
import
XmlDescriptor
,
name_to_pathname
from
lms.djangoapps.review.get_review_ids
import
get_records
log
=
logging
.
getLogger
(
"edx.courseware"
)
log
=
logging
.
getLogger
(
"edx.courseware"
)
# Make '_' a no-op so we can scrape strings. Using lambda instead of
# Make '_' a no-op so we can scrape strings. Using lambda instead of
...
@@ -83,6 +85,16 @@ class HtmlBlock(object):
...
@@ -83,6 +85,16 @@ class HtmlBlock(object):
# but for now the XModule mixin requires that this method be defined.
# but for now the XModule mixin requires that this method be defined.
# pylint: disable=no-member
# pylint: disable=no-member
if
self
.
system
.
anonymous_student_id
:
if
self
.
system
.
anonymous_student_id
:
# List of 5 problem urls I want to show
url_list
=
get_records
(
5
,
self
.
course_id
)
# for i in xrange(len(url_list)):
# Adds the problem urls into the iFrame template
# self.data = self.data.format("%%PROBLEM_URL_" + str(i) +"%%", url_list[i])
return
self
.
data
.
format
(
PROBLEM_URL_0
=
url_list
[
0
],
PROBLEM_URL_1
=
url_list
[
1
],
PROBLEM_URL_2
=
url_list
[
2
],
PROBLEM_URL_3
=
url_list
[
3
],
PROBLEM_URL_4
=
url_list
[
4
])
return
self
.
data
.
replace
(
"
%%
USER_ID
%%
"
,
self
.
system
.
anonymous_student_id
)
return
self
.
data
.
replace
(
"
%%
USER_ID
%%
"
,
self
.
system
.
anonymous_student_id
)
return
self
.
data
return
self
.
data
...
...
common/lib/xmodule/xmodule/templates/html/dillon_iframe.yaml
0 → 100644
View file @
e98a9c79
---
metadata
:
display_name
:
Dillon IFrame Tool
data
:
|
<h3 class="hd hd-2">Dillon Review Tool</h3>
<iframe title="Dillon Review Test 1" src="{PROBLEM_URL_0}" width="100%" height="550" marginwidth="0" marginheight="0" frameborder="0">
Your browser does not support IFrames.
</iframe>
<iframe title="Dillon Review Test 2" src="{PROBLEM_URL_1}" width="100%" height="550" marginwidth="0" marginheight="0" frameborder="0">
Your browser does not support IFrames.
</iframe>
<iframe title="Dillon Review Test 3" src="{PROBLEM_URL_2}" width="100%" height="550" marginwidth="0" marginheight="0" frameborder="0">
Your browser does not support IFrames.
</iframe>
<iframe title="Dillon Review Test 4" src="{PROBLEM_URL_3}" width="100%" height="550" marginwidth="0" marginheight="0" frameborder="0">
Your browser does not support IFrames.
</iframe>
<iframe title="Dillon Review Test 5" src="{PROBLEM_URL_4}" width="100%" height="550" marginwidth="0" marginheight="0" frameborder="0">
Your browser does not support IFrames.
</iframe>
lms/djangoapps/review/__init__.py
0 → 100644
View file @
e98a9c79
"""
Logic for the review block to grab records from the database.
"""
lms/djangoapps/review/get_review_ids.py
0 → 100644
View file @
e98a9c79
'''
Description
'''
import
logging
from
courseware.models
import
StudentModule
from
opaque_keys.edx.locator
import
CourseLocator
import
crum
import
random
log
=
logging
.
getLogger
(
__name__
)
DATABASE
=
'csm'
REVIEW_COURSE_MAPPING
=
{
'course-v1:DillonX+DAD401+2017_T3'
:
'DillonX+DAD402+2017_T3'
,
'course-v1:DillonX+DAD301+2017_T3'
:
'DillonX+DAD302+2017_T3'
}
# SQL_query = 'SELECT state, grade, max_grade FROM courseware_studentmodule '\
# 'WHERE student_id='{student_id}' AND course_id='{course_id}' '\
# 'AND module_type='problem';'
def
get_records
(
num_desired
,
current_course
):
user
=
crum
.
get_current_user
()
problem_ids
=
[]
# dummy_course = CourseLocator(u'DummyX', u'Dummy1', u'2017_T3', None, None)
# course = [key for key in user.__dict__['_anonymous_id'].keys() if type(key) == type(dummy_course)][0]
for
record
in
StudentModule
.
objects
.
filter
(
**
{
'student_id'
:
user
.
id
,
'course_id'
:
current_course
,
'module_type'
:
'problem'
}):
problem
=
str
(
record
.
module_state_key
)
.
split
(
"@"
)
problem_ids
.
append
(
problem
[
-
1
])
problems_to_show
=
random
.
sample
(
problem_ids
,
num_desired
)
review_course_id
=
REVIEW_COURSE_MAPPING
[
str
(
current_course
)]
template_url
=
'https://dillon-dumesnil.sandbox.edx.org/xblock/block-v1:{course_id}+type@problem+block@{problem_id}'
# local_template_url = '/xblock/block-v1:{course_id}+type@problem+block@{problem_id}'
urls
=
[]
for
problem
in
problems_to_show
:
urls
.
append
(
local_template_url
.
format
(
course_id
=
review_course_id
,
problem_id
=
problem
))
return
urls
# return template_url.format(course_id=review_course_id, problem_id=problem_to_show)
# return 'https://courses.edx.org/xblock/block-v1:MITx+6.002.1x_1+2T2016+type@problem+block@903ce05eb08e452ba9991a2756d3cce2'
# return '/xblock/block-v1:DillonX+DAD301+2017_T3+type@problem+block@050d2b4ce4514c888ff654c5972cc1fa'
# return '/xblock/block-v1:DillonX+DAD101+2017_T3+type@problem+block@68b08558f32b49e7aa1841015e24a296'
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