Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added normalize column to export grade book to remote gradebook #209

30 changes: 29 additions & 1 deletion AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,32 @@ Alessandro Verdura <[email protected]>
Sven Marnach <[email protected]>
Richard Moch <[email protected]>
Albert Liang <[email protected]>

Pan Luo <[email protected]>
Tyler Nickerson <[email protected]>
Vedran Karačić <[email protected]>
William Ono <[email protected]>
Dongwook Yoon <[email protected]>
Awais Qureshi <[email protected]>
Eric Fischer <[email protected]>
Brian Beggs <[email protected]>
Bill DeRusha <[email protected]>
Kevin Falcone <[email protected]>
Mirjam Škarica <[email protected]>
Saleem Latif <[email protected]>
Julien Paillé <[email protected]>
Michael Frey <[email protected]>
Hasnain Naveed <[email protected]>
J. Cliff Dyer <[email protected]>
Jamie Folsom <[email protected]>
George Schneeloch <[email protected]>
Dustin Gadal <[email protected]>
Ibrahim Ahmed <[email protected]>
Robert Raposa <[email protected]>
Giovanni Di Milia <[email protected]>
Peter Wilkins <[email protected]>
Justin Abrahms <[email protected]>
Arbab Nazar <[email protected]>
Douglas Hall <[email protected]>
Awais Jibran <[email protected]>
Muhammad Rehan <[email protected]>
Shawn Milochik <[email protected]>
16 changes: 15 additions & 1 deletion common/lib/xmodule/xmodule/course_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from xmodule.mixin import LicenseMixin
import json

from xblock.core import XBlock
from xblock.fields import Scope, List, String, Dict, Boolean, Integer, Float
from .fields import Date
from django.utils.timezone import UTC
Expand Down Expand Up @@ -1315,11 +1316,15 @@ def grading_context(self):
except UndefinedContext:
module = self

def possibly_scored(usage_key):
"""Can this XBlock type can have a score or children?"""
return usage_key.block_type in self.block_types_affecting_grading

all_descriptors = []
graded_sections = {}

def yield_descriptor_descendents(module_descriptor):
for child in module_descriptor.get_children():
for child in module_descriptor.get_children(usage_key_filter=possibly_scored):
yield child
for module_descriptor in yield_descriptor_descendents(child):
yield module_descriptor
Expand All @@ -1345,6 +1350,15 @@ def yield_descriptor_descendents(module_descriptor):
return {'graded_sections': graded_sections,
'all_descriptors': all_descriptors, }

@lazy
def block_types_affecting_grading(self):
"""Return all block types that could impact grading (i.e. scored, or having children)."""
return frozenset(
cat for (cat, xblock_class) in XBlock.load_classes() if (
getattr(xblock_class, 'has_score', False) or getattr(xblock_class, 'has_children', False)
)
)

@staticmethod
def make_id(org, course, url_name):
return '/'.join([org, course, url_name])
Expand Down
6 changes: 3 additions & 3 deletions common/lib/xmodule/xmodule/graders.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
Score = namedtuple("Score", "earned possible graded section module_id")


def aggregate_scores(scores, section_name="summary"):
def aggregate_scores(scores, section_name="summary", section_location=None):
"""
scores: A list of Score objects
returns: A tuple (all_total, graded_total).
Expand All @@ -32,15 +32,15 @@ def aggregate_scores(scores, section_name="summary"):
total_possible,
False,
section_name,
None
section_location
)
#selecting only graded things
graded_total = Score(
total_correct_graded,
total_possible_graded,
True,
section_name,
None
section_location
)

return all_total, graded_total
Expand Down
54 changes: 29 additions & 25 deletions lms/djangoapps/ccx/tests/test_field_override_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

@attr('shard_1')
@mock.patch.dict(
'django.conf.settings.FEATURES', {'ENABLE_XBLOCK_VIEW_ENDPOINT': True}
'django.conf.settings.FEATURES',
{
'ENABLE_XBLOCK_VIEW_ENDPOINT': True,
'ENABLE_MAX_SCORE_CACHE': False,
}
)
@ddt.ddt
class FieldOverridePerformanceTestCase(ProceduralCourseTestMixin,
Expand Down Expand Up @@ -173,18 +177,18 @@ class TestFieldOverrideMongoPerformance(FieldOverridePerformanceTestCase):

TEST_DATA = {
# (providers, course_width, enable_ccx): # of sql queries, # of mongo queries, # of xblocks
('no_overrides', 1, True): (27, 7, 14),
('no_overrides', 2, True): (135, 7, 85),
('no_overrides', 3, True): (595, 7, 336),
('ccx', 1, True): (27, 7, 14),
('ccx', 2, True): (135, 7, 85),
('ccx', 3, True): (595, 7, 336),
('no_overrides', 1, False): (27, 7, 14),
('no_overrides', 2, False): (135, 7, 85),
('no_overrides', 3, False): (595, 7, 336),
('ccx', 1, False): (27, 7, 14),
('ccx', 2, False): (135, 7, 85),
('ccx', 3, False): (595, 7, 336),
('no_overrides', 1, True): (23, 7, 14),
('no_overrides', 2, True): (68, 7, 85),
('no_overrides', 3, True): (263, 7, 336),
('ccx', 1, True): (23, 7, 14),
('ccx', 2, True): (68, 7, 85),
('ccx', 3, True): (263, 7, 336),
('no_overrides', 1, False): (23, 7, 14),
('no_overrides', 2, False): (68, 7, 85),
('no_overrides', 3, False): (263, 7, 336),
('ccx', 1, False): (23, 7, 14),
('ccx', 2, False): (68, 7, 85),
('ccx', 3, False): (263, 7, 336),
}


Expand All @@ -196,16 +200,16 @@ class TestFieldOverrideSplitPerformance(FieldOverridePerformanceTestCase):
__test__ = True

TEST_DATA = {
('no_overrides', 1, True): (27, 4, 9),
('no_overrides', 2, True): (135, 19, 54),
('no_overrides', 3, True): (595, 84, 215),
('ccx', 1, True): (27, 4, 9),
('ccx', 2, True): (135, 19, 54),
('ccx', 3, True): (595, 84, 215),
('no_overrides', 1, False): (27, 4, 9),
('no_overrides', 2, False): (135, 19, 54),
('no_overrides', 3, False): (595, 84, 215),
('ccx', 1, False): (27, 4, 9),
('ccx', 2, False): (135, 19, 54),
('ccx', 3, False): (595, 84, 215),
('no_overrides', 1, True): (23, 4, 9),
('no_overrides', 2, True): (68, 19, 54),
('no_overrides', 3, True): (263, 84, 215),
('ccx', 1, True): (23, 4, 9),
('ccx', 2, True): (68, 19, 54),
('ccx', 3, True): (263, 84, 215),
('no_overrides', 1, False): (23, 4, 9),
('no_overrides', 2, False): (68, 19, 54),
('no_overrides', 3, False): (263, 84, 215),
('ccx', 1, False): (23, 4, 9),
('ccx', 2, False): (68, 19, 54),
('ccx', 3, False): (263, 84, 215),
}
Loading