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 <finalmente2@tin.it>
Sven Marnach <sven@marnach.net>
Richard Moch <richard.moch@gmail.com>
Albert Liang <albertliangcode@gmail.com>

Pan Luo <pan.luo@ubc.ca>
Tyler Nickerson <nickersoft@gmail.com>
Vedran Karačić <vedran@edx.org>
William Ono <william.ono@ubc.ca>
Dongwook Yoon <dy252@cornell.edu>
Awais Qureshi <awais.qureshi@arbisoft.com>
Eric Fischer <efischer@edx.org>
Brian Beggs <macdiesel@gmail.com>
Bill DeRusha <bill@edx.org>
Kevin Falcone <kevin@edx.org>
Mirjam Škarica <mirjamskarica@gmail.com>
Saleem Latif <saleem@edx.org>
Julien Paillé <julien.paille@openfun.fr>
Michael Frey <mfrey@edx.org>
Hasnain Naveed <hasnain@edx.org>
J. Cliff Dyer <cdyer@edx.org>
Jamie Folsom <jfolsom@mit.edu>
George Schneeloch <gschneel@mit.edu>
Dustin Gadal <Dustin.Gadal@gmail.com>
Ibrahim Ahmed <ibrahimahmed443@gmail.com>
Robert Raposa <rraposa@edx.org>
Giovanni Di Milia <gdimilia@mit.edu>
Peter Wilkins <pwilkins@mit.edu>
Justin Abrahms <abrahms@mit.edu>
Arbab Nazar <arbab@edx.org>
Douglas Hall <dhall@edx.org>
Awais Jibran <awaisdar001@gmail.com>
Muhammad Rehan <muhammadrehan69@gmail.com>
Shawn Milochik <shawn@milochik.com>
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