Commit 3e293f2a by Bridger Maxwell

Merge branch 'master' into grade-refactor

parents a763edab eff95c26
...@@ -41,6 +41,12 @@ def object_cache(cache, user, module_type, module_id): ...@@ -41,6 +41,12 @@ def object_cache(cache, user, module_type, module_id):
return None return None
def make_track_function(request): 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): def f(event_type, event):
return track.views.server_track(request, event_type, event, page='x_module') return track.views.server_track(request, event_type, event, page='x_module')
return f return f
...@@ -87,6 +93,20 @@ def modx_dispatch(request, module=None, dispatch=None, id=None): ...@@ -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 whatever the module wanted to return to the client/caller
return HttpResponse(ajax_return) 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): def render_x_module(user, request, xml_module, module_object_preload):
''' Generic module for extensions. This renders to HTML. ''' ''' Generic module for extensions. This renders to HTML. '''
# Check if problem has an instance in DB # Check if problem has an instance in DB
...@@ -125,7 +145,8 @@ def render_x_module(user, request, xml_module, module_object_preload): ...@@ -125,7 +145,8 @@ def render_x_module(user, request, xml_module, module_object_preload):
# Grab content # Grab content
content = instance.get_html() content = instance.get_html()
if user.is_staff: 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, content = {'content':content,
"destroy_js":instance.get_destroy_js(), "destroy_js":instance.get_destroy_js(),
'init_js':instance.get_init_js(), 'init_js':instance.get_init_js(),
......
...@@ -65,7 +65,7 @@ class CircuitLink(markdown.inlinepatterns.Pattern): ...@@ -65,7 +65,7 @@ class CircuitLink(markdown.inlinepatterns.Pattern):
def handleMatch(self, m): def handleMatch(self, m):
data = m.group('data') data = m.group('data')
data = escape(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) : def makeExtension(configs=None) :
......
...@@ -6,9 +6,9 @@ REPO_ROOT = File.dirname(__FILE__) ...@@ -6,9 +6,9 @@ REPO_ROOT = File.dirname(__FILE__)
BUILD_DIR = File.join(REPO_ROOT, "build") BUILD_DIR = File.join(REPO_ROOT, "build")
# Packaging constants # Packaging constants
DEPLOY_DIR = "/opt/wwc" DEPLOY_DIR = "/opt/packages"
PACKAGE_NAME = "mitx" PACKAGE_NAME = "mitx"
LINK_PATH = File.join(DEPLOY_DIR, PACKAGE_NAME) LINK_PATH = "/opt/wwc/mitx"
VERSION = "0.1" VERSION = "0.1"
COMMIT = (ENV["GIT_COMMIT"] || `git rev-parse HEAD`).chomp()[0, 10] 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('/', '_') BRANCH = (ENV["GIT_BRANCH"] || `git symbolic-ref -q HEAD`).chomp().gsub('refs/heads/', '').gsub('origin/', '').gsub('/', '_')
......
...@@ -13,7 +13,7 @@ STATIC_GRAB = False ...@@ -13,7 +13,7 @@ STATIC_GRAB = False
DEV_CONTENT = True DEV_CONTENT = True
LIB_URL = '/static/js/' 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 = '/static/book/'
BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/' BOOK_URL = 'https://mitxstatic.s3.amazonaws.com/book_images/'
...@@ -550,8 +550,8 @@ LIVESETTINGS_OPTIONS = { ...@@ -550,8 +550,8 @@ LIVESETTINGS_OPTIONS = {
}, },
'MARKUP' : { 'MARKUP' : {
'MARKUP_CODE_FRIENDLY' : False, 'MARKUP_CODE_FRIENDLY' : False,
'ENABLE_MATHJAX' : False, # FIXME: Test with this enabled 'ENABLE_MATHJAX' : True, # FIXME: Test with this enabled
'MATHJAX_BASE_URL' : u'', 'MATHJAX_BASE_URL' : u'/static/js/mathjax-MathJax-c9db6ac/',
'ENABLE_AUTO_LINKING' : False, 'ENABLE_AUTO_LINKING' : False,
'AUTO_LINK_PATTERNS' : u'', 'AUTO_LINK_PATTERNS' : u'',
'AUTO_LINK_URLS' : u'', 'AUTO_LINK_URLS' : u'',
......
This source diff could not be displayed because it is too large. You can view the blob instead.
var schematic_height = 300; var schematic_height = 480;
var schematic_width = 500; var schematic_width = 640;
$(function(){ $(function(){
$(document).ready(function() { $(document).ready(function() {
......
../../3rdParty/static/js/
\ No newline at end of file
...@@ -79,7 +79,7 @@ div.graph-controls, div#graph-listen { ...@@ -79,7 +79,7 @@ div.graph-controls, div#graph-listen {
font-weight: bold; font-weight: bold;
padding: 3px; padding: 3px;
} }
//MOSFET AMPLIFIER
label[for="vinCheckbox"], label[for="vinRadioButton"]{ label[for="vinCheckbox"], label[for="vinRadioButton"]{
color: desaturate(#00bfff, 50%); color: desaturate(#00bfff, 50%);
} }
...@@ -89,6 +89,13 @@ div.graph-controls, div#graph-listen { ...@@ -89,6 +89,13 @@ div.graph-controls, div#graph-listen {
label[for="vrCheckbox"], label[for="vrRadioButton"]{ label[for="vrCheckbox"], label[for="vrRadioButton"]{
color: desaturate(#1df914, 40%); 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 { ...@@ -199,22 +199,22 @@ section.course-content {
border-right: 1px solid #000; border-right: 1px solid #000;
@include box-shadow(1px 0 0 #555, inset 1px 0 0 #555); @include box-shadow(1px 0 0 #555, inset 1px 0 0 #555);
float: left; float: left;
line-height: 46px; //height of play pause buttons line-height: 0;
padding-right: lh(.25);
margin-right: 0; margin-right: 0;
position: relative;
@include transition(); @include transition();
width: 110px;
cursor: pointer; cursor: pointer;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
h3 { h3 {
@include inline-block(); float: left;
padding: 0 lh(.25) 0 lh(.5); padding: 0 lh(.25) 0 lh(.5);
font-weight: normal; font-weight: normal;
text-transform: uppercase; text-transform: uppercase;
font-size: 12px; font-size: 12px;
letter-spacing: 1px; letter-spacing: 1px;
color: #999; color: #999;
line-height: 46px; //height of play pause buttons
} }
p.active { p.active {
...@@ -222,27 +222,19 @@ section.course-content { ...@@ -222,27 +222,19 @@ section.course-content {
padding: 0 lh(.5) 0 0; padding: 0 lh(.5) 0 0;
margin-bottom: 0; margin-bottom: 0;
font-weight: bold; font-weight: bold;
display: none;
} }
// fix for now // fix for now
ol#video_speeds { ol#video_speeds {
background-color: #444;
border: 1px solid #000;
border-top: 0;
@include box-shadow(inset 1px 0 0 #555);
@include inline-block(); @include inline-block();
left: -1px;
position: absolute;
top: 48px;
width: 100%;
z-index: 10;
li { li {
border-bottom: 1px solid #000; float: left;
@include box-shadow( 0 1px 0 #555);
color: #fff; color: #fff;
cursor: pointer; cursor: pointer;
padding: 0 lh(.5); padding: 0 lh(.25);
line-height: 46px; //height of play pause buttons
&.active { &.active {
font-weight: bold; font-weight: bold;
...@@ -255,15 +247,13 @@ section.course-content { ...@@ -255,15 +247,13 @@ section.course-content {
} }
&:hover { &:hover {
color: #aaa; background-color: #444;
background-color: #666;
} }
} }
} }
&:hover { &:hover {
opacity: 1; opacity: 1;
background-color: #444;
} }
} }
......
<div class="staff_info"> <div class="staff_info">
${xml | h} ${xml | h}
</div> </div>
<div>
${ str(histogram) }
</div>
...@@ -69,12 +69,6 @@ ...@@ -69,12 +69,6 @@
$(this).toggleClass("off"); $(this).toggleClass("off");
return false; return false;
}); });
$("ol#video_speeds").hide();
$("div.speeds").click(function() {
$("ol#video_speeds").slideToggle(150);
});
}); });
</script> </script>
</%block> </%block>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment