Merge branch 'master' into bug/christina/misc
This commit is contained in:
@@ -1,3 +1 @@
|
||||
from xmodule.templates import update_templates
|
||||
|
||||
update_templates()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
from xmodule.templates import update_templates
|
||||
from django.core.management.base import BaseCommand
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = \
|
||||
'''Imports and updates the Studio component templates from the code pack and put in the DB'''
|
||||
|
||||
def handle(self, *args, **options):
|
||||
update_templates()
|
||||
@@ -316,6 +316,10 @@ class CourseDescriptor(SequenceDescriptor):
|
||||
if isinstance(value, time.struct_time):
|
||||
self.metadata['enrollment_end'] = stringify_time(value)
|
||||
|
||||
@property
|
||||
def grader(self):
|
||||
return grader_from_conf(self.raw_grader)
|
||||
|
||||
@property
|
||||
def raw_grader(self):
|
||||
return self._grading_policy['RAW_GRADER']
|
||||
|
||||
@@ -64,7 +64,11 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
|
||||
location = Location(location)
|
||||
json_data = self.module_data.get(location)
|
||||
if json_data is None:
|
||||
return self.modulestore.get_item(location)
|
||||
module = self.modulestore.get_item(location)
|
||||
if module is not None:
|
||||
# update our own cache after going to the DB to get cache miss
|
||||
self.module_data.update(module.system.module_data)
|
||||
return module
|
||||
else:
|
||||
# load the module and apply the inherited metadata
|
||||
try:
|
||||
|
||||
@@ -307,6 +307,10 @@ def index(request, course_id, chapter=None, section=None,
|
||||
# Specifically asked-for section doesn't exist
|
||||
raise Http404
|
||||
|
||||
# cdodge: this looks silly, but let's refetch the section_descriptor with depth=None
|
||||
# which will prefetch the children more efficiently than doing a recursive load
|
||||
section_descriptor = modulestore().get_instance(course.id, section_descriptor.location, depth=None)
|
||||
|
||||
# Load all descendants of the section, because we're going to display its
|
||||
# html, which in general will need all of its children
|
||||
section_module_cache = StudentModuleCache.cache_for_descriptor_descendents(
|
||||
|
||||
@@ -3,6 +3,7 @@ import json
|
||||
from datetime import datetime
|
||||
from django.http import Http404
|
||||
from mitxmako.shortcuts import render_to_response
|
||||
from django.db import connection
|
||||
|
||||
from student.models import CourseEnrollment, CourseEnrollmentAllowed
|
||||
from django.contrib.auth.models import User
|
||||
@@ -12,16 +13,18 @@ def dictfetchall(cursor):
|
||||
'''Returns a list of all rows from a cursor as a column: result dict.
|
||||
Borrowed from Django documentation'''
|
||||
desc = cursor.description
|
||||
table=[]
|
||||
table = []
|
||||
table.append([col[0] for col in desc])
|
||||
table = table + cursor.fetchall()
|
||||
print "Table: " + str(table)
|
||||
|
||||
# ensure response from db is a list, not a tuple (which is returned
|
||||
# by MySQL backed django instances)
|
||||
rows_from_cursor=cursor.fetchall()
|
||||
table = table + [list(row) for row in rows_from_cursor]
|
||||
return table
|
||||
|
||||
def SQL_query_to_list(cursor, query_string):
|
||||
cursor.execute(query_string)
|
||||
raw_result=dictfetchall(cursor)
|
||||
print raw_result
|
||||
return raw_result
|
||||
|
||||
def dashboard(request):
|
||||
@@ -50,7 +53,6 @@ def dashboard(request):
|
||||
results["scalars"]["Total Enrollments Across All Courses"]=CourseEnrollment.objects.count()
|
||||
|
||||
# establish a direct connection to the database (for executing raw SQL)
|
||||
from django.db import connection
|
||||
cursor = connection.cursor()
|
||||
|
||||
# define the queries that will generate our user-facing tables
|
||||
|
||||
7
rakefile
7
rakefile
@@ -440,6 +440,13 @@ namespace :cms do
|
||||
end
|
||||
end
|
||||
|
||||
namespace :cms do
|
||||
desc "Imports all the templates from the code pack"
|
||||
task :update_templates do
|
||||
sh(django_admin(:cms, :dev, :update_templates))
|
||||
end
|
||||
end
|
||||
|
||||
namespace :cms do
|
||||
desc "Import course data within the given DATA_DIR variable"
|
||||
task :xlint do
|
||||
|
||||
Reference in New Issue
Block a user