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
d891361b
Commit
d891361b
authored
Mar 05, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into bug/christina/misc
parents
b0106a41
59250225
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
37 additions
and
8 deletions
+37
-8
cms/djangoapps/contentstore/__init__.py
+0
-2
cms/djangoapps/contentstore/management/commands/update_templates.py
+10
-0
common/lib/xmodule/xmodule/course_module.py
+4
-0
common/lib/xmodule/xmodule/modulestore/mongo.py
+5
-1
lms/djangoapps/courseware/views.py
+4
-0
lms/djangoapps/dashboard/views.py
+7
-5
rakefile
+7
-0
No files found.
cms/djangoapps/contentstore/__init__.py
View file @
d891361b
from
xmodule.templates
import
update_templates
update_templates
()
cms/djangoapps/contentstore/management/commands/update_templates.py
0 → 100644
View file @
d891361b
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
()
\ No newline at end of file
common/lib/xmodule/xmodule/course_module.py
View file @
d891361b
...
@@ -317,6 +317,10 @@ class CourseDescriptor(SequenceDescriptor):
...
@@ -317,6 +317,10 @@ class CourseDescriptor(SequenceDescriptor):
self
.
metadata
[
'enrollment_end'
]
=
stringify_time
(
value
)
self
.
metadata
[
'enrollment_end'
]
=
stringify_time
(
value
)
@property
@property
def
grader
(
self
):
return
grader_from_conf
(
self
.
raw_grader
)
@property
def
raw_grader
(
self
):
def
raw_grader
(
self
):
return
self
.
_grading_policy
[
'RAW_GRADER'
]
return
self
.
_grading_policy
[
'RAW_GRADER'
]
...
...
common/lib/xmodule/xmodule/modulestore/mongo.py
View file @
d891361b
...
@@ -64,7 +64,11 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
...
@@ -64,7 +64,11 @@ class CachingDescriptorSystem(MakoDescriptorSystem):
location
=
Location
(
location
)
location
=
Location
(
location
)
json_data
=
self
.
module_data
.
get
(
location
)
json_data
=
self
.
module_data
.
get
(
location
)
if
json_data
is
None
:
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
:
else
:
# load the module and apply the inherited metadata
# load the module and apply the inherited metadata
try
:
try
:
...
...
lms/djangoapps/courseware/views.py
View file @
d891361b
...
@@ -307,6 +307,10 @@ def index(request, course_id, chapter=None, section=None,
...
@@ -307,6 +307,10 @@ def index(request, course_id, chapter=None, section=None,
# Specifically asked-for section doesn't exist
# Specifically asked-for section doesn't exist
raise
Http404
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
# Load all descendants of the section, because we're going to display its
# html, which in general will need all of its children
# html, which in general will need all of its children
section_module_cache
=
StudentModuleCache
.
cache_for_descriptor_descendents
(
section_module_cache
=
StudentModuleCache
.
cache_for_descriptor_descendents
(
...
...
lms/djangoapps/dashboard/views.py
View file @
d891361b
...
@@ -3,6 +3,7 @@ import json
...
@@ -3,6 +3,7 @@ import json
from
datetime
import
datetime
from
datetime
import
datetime
from
django.http
import
Http404
from
django.http
import
Http404
from
mitxmako.shortcuts
import
render_to_response
from
mitxmako.shortcuts
import
render_to_response
from
django.db
import
connection
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
from
student.models
import
CourseEnrollment
,
CourseEnrollmentAllowed
from
django.contrib.auth.models
import
User
from
django.contrib.auth.models
import
User
...
@@ -12,16 +13,18 @@ def dictfetchall(cursor):
...
@@ -12,16 +13,18 @@ def dictfetchall(cursor):
'''Returns a list of all rows from a cursor as a column: result dict.
'''Returns a list of all rows from a cursor as a column: result dict.
Borrowed from Django documentation'''
Borrowed from Django documentation'''
desc
=
cursor
.
description
desc
=
cursor
.
description
table
=
[]
table
=
[]
table
.
append
([
col
[
0
]
for
col
in
desc
])
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
return
table
def
SQL_query_to_list
(
cursor
,
query_string
):
def
SQL_query_to_list
(
cursor
,
query_string
):
cursor
.
execute
(
query_string
)
cursor
.
execute
(
query_string
)
raw_result
=
dictfetchall
(
cursor
)
raw_result
=
dictfetchall
(
cursor
)
print
raw_result
return
raw_result
return
raw_result
def
dashboard
(
request
):
def
dashboard
(
request
):
...
@@ -50,7 +53,6 @@ def dashboard(request):
...
@@ -50,7 +53,6 @@ def dashboard(request):
results
[
"scalars"
][
"Total Enrollments Across All Courses"
]
=
CourseEnrollment
.
objects
.
count
()
results
[
"scalars"
][
"Total Enrollments Across All Courses"
]
=
CourseEnrollment
.
objects
.
count
()
# establish a direct connection to the database (for executing raw SQL)
# establish a direct connection to the database (for executing raw SQL)
from
django.db
import
connection
cursor
=
connection
.
cursor
()
cursor
=
connection
.
cursor
()
# define the queries that will generate our user-facing tables
# define the queries that will generate our user-facing tables
...
...
rakefile
View file @
d891361b
...
@@ -441,6 +441,13 @@ namespace :cms do
...
@@ -441,6 +441,13 @@ namespace :cms do
end
end
namespace
:cms
do
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"
desc
"Import course data within the given DATA_DIR variable"
task
:xlint
do
task
:xlint
do
if
ENV
[
'DATA_DIR'
]
and
ENV
[
'COURSE_DIR'
]
if
ENV
[
'DATA_DIR'
]
and
ENV
[
'COURSE_DIR'
]
...
...
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