Merge branch 'master' into grade-refactor
This commit is contained in:
@@ -41,6 +41,12 @@ def object_cache(cache, user, module_type, module_id):
|
||||
return None
|
||||
|
||||
def make_track_function(request):
|
||||
''' We want the capa problem (and other modules) to be able to
|
||||
track/log what happens inside them without adding dependencies on
|
||||
Django or the rest of the codebase. We do this by passing a
|
||||
tracking function to them. This generates a closure for each request
|
||||
that gives a clean interface on both sides.
|
||||
'''
|
||||
def f(event_type, event):
|
||||
return track.views.server_track(request, event_type, event, page='x_module')
|
||||
return f
|
||||
@@ -87,6 +93,20 @@ def modx_dispatch(request, module=None, dispatch=None, id=None):
|
||||
# Return whatever the module wanted to return to the client/caller
|
||||
return HttpResponse(ajax_return)
|
||||
|
||||
def grade_histogram(module_id):
|
||||
''' Print out a histogram of grades on a given problem.
|
||||
Part of staff member debug info.
|
||||
'''
|
||||
from django.db import connection, transaction
|
||||
cursor = connection.cursor()
|
||||
|
||||
cursor.execute("select courseware_studentmodule.grade,COUNT(courseware_studentmodule.student_id) from courseware_studentmodule where courseware_studentmodule.module_id=%s group by courseware_studentmodule.grade", [module_id])
|
||||
|
||||
grades = list(cursor.fetchall())
|
||||
print grades
|
||||
grades.sort(key=lambda x:x[0]) # Probably not necessary
|
||||
return grades
|
||||
|
||||
def render_x_module(user, request, xml_module, module_object_preload):
|
||||
''' Generic module for extensions. This renders to HTML. '''
|
||||
# Check if problem has an instance in DB
|
||||
@@ -125,7 +145,8 @@ def render_x_module(user, request, xml_module, module_object_preload):
|
||||
# Grab content
|
||||
content = instance.get_html()
|
||||
if user.is_staff:
|
||||
content=content+render_to_string("staff_problem_info.html", {'xml':etree.tostring(xml_module)})
|
||||
content=content+render_to_string("staff_problem_info.html", {'xml':etree.tostring(xml_module),
|
||||
'histogram':grade_histogram(module_id)})
|
||||
content = {'content':content,
|
||||
"destroy_js":instance.get_destroy_js(),
|
||||
'init_js':instance.get_init_js(),
|
||||
|
||||
@@ -65,7 +65,7 @@ class CircuitLink(markdown.inlinepatterns.Pattern):
|
||||
def handleMatch(self, m):
|
||||
data = m.group('data')
|
||||
data = escape(data)
|
||||
return etree.fromstring("<div align='center'><input type='hidden' parts='' value='" + data + "' analyses='' class='schematic ctrls' width='500' height='300'/></div>")
|
||||
return etree.fromstring("<div align='center'><input type='hidden' parts='' value='" + data + "' analyses='' class='schematic ctrls' width='640' height='480'/></div>")
|
||||
|
||||
|
||||
def makeExtension(configs=None) :
|
||||
|
||||
4
rakefile
4
rakefile
@@ -6,9 +6,9 @@ REPO_ROOT = File.dirname(__FILE__)
|
||||
BUILD_DIR = File.join(REPO_ROOT, "build")
|
||||
|
||||
# Packaging constants
|
||||
DEPLOY_DIR = "/opt/wwc"
|
||||
DEPLOY_DIR = "/opt/packages"
|
||||
PACKAGE_NAME = "mitx"
|
||||
LINK_PATH = File.join(DEPLOY_DIR, PACKAGE_NAME)
|
||||
LINK_PATH = "/opt/wwc/mitx"
|
||||
VERSION = "0.1"
|
||||
COMMIT = (ENV["GIT_COMMIT"] || `git rev-parse HEAD`).chomp()[0, 10]
|
||||
BRANCH = (ENV["GIT_BRANCH"] || `git symbolic-ref -q HEAD`).chomp().gsub('refs/heads/', '').gsub('origin/', '').gsub('/', '_')
|
||||
|
||||
@@ -13,7 +13,7 @@ STATIC_GRAB = False
|
||||
DEV_CONTENT = True
|
||||
|
||||
LIB_URL = '/static/js/'
|
||||
LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/'
|
||||
# LIB_URL = 'https://mitxstatic.s3.amazonaws.com/js/' # No longer using S3 for this
|
||||
BOOK_URL = '/static/book/'
|
||||
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/'
|
||||
|
||||
@@ -550,8 +550,8 @@ LIVESETTINGS_OPTIONS = {
|
||||
},
|
||||
'MARKUP' : {
|
||||
'MARKUP_CODE_FRIENDLY' : False,
|
||||
'ENABLE_MATHJAX' : False, # FIXME: Test with this enabled
|
||||
'MATHJAX_BASE_URL' : u'',
|
||||
'ENABLE_MATHJAX' : True, # FIXME: Test with this enabled
|
||||
'MATHJAX_BASE_URL' : u'/static/js/mathjax-MathJax-c9db6ac/',
|
||||
'ENABLE_AUTO_LINKING' : False,
|
||||
'AUTO_LINK_PATTERNS' : u'',
|
||||
'AUTO_LINK_URLS' : u'',
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
var schematic_height = 300;
|
||||
var schematic_width = 500;
|
||||
var schematic_height = 480;
|
||||
var schematic_width = 640;
|
||||
|
||||
$(function(){
|
||||
$(document).ready(function() {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
../../3rdParty/static/js/
|
||||
@@ -79,7 +79,7 @@ div.graph-controls, div#graph-listen {
|
||||
font-weight: bold;
|
||||
padding: 3px;
|
||||
}
|
||||
|
||||
//MOSFET AMPLIFIER
|
||||
label[for="vinCheckbox"], label[for="vinRadioButton"]{
|
||||
color: desaturate(#00bfff, 50%);
|
||||
}
|
||||
@@ -89,6 +89,13 @@ div.graph-controls, div#graph-listen {
|
||||
label[for="vrCheckbox"], label[for="vrRadioButton"]{
|
||||
color: desaturate(#1df914, 40%);
|
||||
}
|
||||
|
||||
//RC Filters
|
||||
label[for="vcCheckbox"], label[for="vcRadioButton"]{
|
||||
color: darken(#ffcf48, 20%);
|
||||
}
|
||||
//RLC Series
|
||||
label[for="vlCheckbox"], label[for="vlRadioButton"]{
|
||||
color: desaturate(#d33682, 40%);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -199,22 +199,22 @@ section.course-content {
|
||||
border-right: 1px solid #000;
|
||||
@include box-shadow(1px 0 0 #555, inset 1px 0 0 #555);
|
||||
float: left;
|
||||
line-height: 46px; //height of play pause buttons
|
||||
line-height: 0;
|
||||
padding-right: lh(.25);
|
||||
margin-right: 0;
|
||||
position: relative;
|
||||
@include transition();
|
||||
width: 110px;
|
||||
cursor: pointer;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
|
||||
h3 {
|
||||
@include inline-block();
|
||||
float: left;
|
||||
padding: 0 lh(.25) 0 lh(.5);
|
||||
font-weight: normal;
|
||||
text-transform: uppercase;
|
||||
font-size: 12px;
|
||||
letter-spacing: 1px;
|
||||
color: #999;
|
||||
line-height: 46px; //height of play pause buttons
|
||||
}
|
||||
|
||||
p.active {
|
||||
@@ -222,27 +222,19 @@ section.course-content {
|
||||
padding: 0 lh(.5) 0 0;
|
||||
margin-bottom: 0;
|
||||
font-weight: bold;
|
||||
display: none;
|
||||
}
|
||||
|
||||
// fix for now
|
||||
ol#video_speeds {
|
||||
background-color: #444;
|
||||
border: 1px solid #000;
|
||||
border-top: 0;
|
||||
@include box-shadow(inset 1px 0 0 #555);
|
||||
@include inline-block();
|
||||
left: -1px;
|
||||
position: absolute;
|
||||
top: 48px;
|
||||
width: 100%;
|
||||
z-index: 10;
|
||||
|
||||
li {
|
||||
border-bottom: 1px solid #000;
|
||||
@include box-shadow( 0 1px 0 #555);
|
||||
float: left;
|
||||
color: #fff;
|
||||
cursor: pointer;
|
||||
padding: 0 lh(.5);
|
||||
padding: 0 lh(.25);
|
||||
line-height: 46px; //height of play pause buttons
|
||||
|
||||
&.active {
|
||||
font-weight: bold;
|
||||
@@ -255,15 +247,13 @@ section.course-content {
|
||||
}
|
||||
|
||||
&:hover {
|
||||
color: #aaa;
|
||||
background-color: #666;
|
||||
background-color: #444;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
background-color: #444;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
<div class="staff_info">
|
||||
${xml | h}
|
||||
</div>
|
||||
<div>
|
||||
${ str(histogram) }
|
||||
</div>
|
||||
|
||||
@@ -69,12 +69,6 @@
|
||||
$(this).toggleClass("off");
|
||||
return false;
|
||||
});
|
||||
|
||||
$("ol#video_speeds").hide();
|
||||
|
||||
$("div.speeds").click(function() {
|
||||
$("ol#video_speeds").slideToggle(150);
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</%block>
|
||||
|
||||
Reference in New Issue
Block a user