public void CopySettingsFrom(ScoringGroup otherScoringGroup) { _canBeSetByInstructor = string.IsNullOrEmpty(_canBeSetByInstructor) ? otherScoringGroup._canBeSetByInstructor : _canBeSetByInstructor; _maxAdditionalScore = string.IsNullOrEmpty(_maxAdditionalScore) ? otherScoringGroup._maxAdditionalScore : _maxAdditionalScore; _enabledForEveryone = string.IsNullOrEmpty(_enabledForEveryone) ? otherScoringGroup._enabledForEveryone : _enabledForEveryone; Abbreviation = Abbreviation ?? otherScoringGroup.Abbreviation; Name = string.IsNullOrEmpty(Name) ? otherScoringGroup.Name : Name; }
private static void AddDefaultScoringGroupIfNeeded(IEnumerable <Unit> units, IEnumerable <Slide> slides, CourseSettings settings) { if (slides.Any(s => s.ShouldBeSolved && string.IsNullOrEmpty(s.ScoringGroup))) { var defaultScoringGroup = new ScoringGroup { Id = "", Abbreviation = "Баллы", Name = "Упражнения и тесты", }; settings.Scoring.Groups.Add(defaultScoringGroup.Id, defaultScoringGroup); /* Add default scoring group to each unit */ foreach (var unit in units) { unit.Scoring.Groups.Add(defaultScoringGroup.Id, defaultScoringGroup); } } }
public ScoringSettings() { _groups = new ScoringGroup[0]; }