@Override public Map<String, org.sakaiproject.service.gradebook.shared.CourseGrade> getCourseGradeForStudents(final String gradebookUid, final List<String> userUuids) { final Map<String, org.sakaiproject.service.gradebook.shared.CourseGrade> rval = new HashMap<>(); try { final Gradebook gradebook = getGradebook(gradebookUid); final GradeMapping gradeMap = gradebook.getSelectedGradeMapping(); rval.putAll(this.getCourseGradeForStudents(gradebookUid, userUuids, gradeMap.getGradeMap())); } catch (final Exception e) { log.error("Error in getCourseGradeForStudents", e); } return rval; }
@Override public Map<String,org.sakaiproject.service.gradebook.shared.CourseGrade> getCourseGradeForStudents(final String gradebookUid, final List<String> userUuids) { final Map<String,org.sakaiproject.service.gradebook.shared.CourseGrade> rval = new HashMap<>(); try { final Gradebook gradebook = getGradebook(gradebookUid); final GradeMapping gradeMap = gradebook.getSelectedGradeMapping(); rval.putAll(this.getCourseGradeForStudents(gradebookUid, userUuids, gradeMap.getGradeMap())); } catch(final Exception e) { log.error("Error in getCourseGradeForStudents", e); } return rval; }
/** * @return Returns the displayGrade. */ public String getDisplayGrade() { if (this.enteredGrade != null) { return this.enteredGrade; } else { return getCourseGrade().getGradebook().getSelectedGradeMapping().getMappedGrade(this.autoCalculatedGrade); } }
/** * This method will fail unless this course grade was fetched "with statistics", since it relies on having the total number of points * possible available to calculate the percentage. * * @see org.sakaiproject.tool.gradebook.AbstractGradeRecord#getGradeAsPercentage() */ @Override public Double getGradeAsPercentage() { if (this.enteredGrade == null) { return this.autoCalculatedGrade; } else { return getCourseGrade().getGradebook().getSelectedGradeMapping().getValue(this.enteredGrade); } }
public void updateGradebook(final Gradebook gradebook) throws StaleObjectModificationException { HibernateCallback hc = session -> { // Get the gradebook and selected mapping from persistence Gradebook gradebookFromPersistence = (Gradebook)session.load(gradebook.getClass(), gradebook.getId()); GradeMapping mappingFromPersistence = gradebookFromPersistence.getSelectedGradeMapping(); // If the mapping has changed, and there are explicitly entered // course grade records, disallow this update. if (!mappingFromPersistence.getId().equals(gradebook.getSelectedGradeMapping().getId())) { if(isExplicitlyEnteredCourseGradeRecords(gradebook.getId())) { throw new IllegalStateException("Selected grade mapping can not be changed, since explicit course grades exist."); } } // Evict the persisted objects from the session and update the gradebook // so the new grade mapping is used in the sort column update //session.evict(mappingFromPersistence); for(Iterator iter = gradebookFromPersistence.getGradeMappings().iterator(); iter.hasNext();) { session.evict(iter.next()); } session.evict(gradebookFromPersistence); try { session.update(gradebook); session.flush(); } catch (StaleObjectStateException e) { throw new StaleObjectModificationException(e); } return null; }; getHibernateTemplate().execute(hc); }
courseGradeLetter = gradebook.getSelectedGradeMapping().getMappedGrade(courseGrade.getMean());
courseGradeLetter = gradebook.getSelectedGradeMapping().getMappedGrade(courseGrade.getMean());
final CourseGradeRecord gradeRecord = (CourseGradeRecord) iter.next(); final GradeMapping gradeMap = thisGradebook.getSelectedGradeMapping();
public void updateGradebook(final Gradebook gradebook) throws StaleObjectModificationException { final HibernateCallback hc = session -> { // Get the gradebook and selected mapping from persistence final Gradebook gradebookFromPersistence = (Gradebook)session.load(gradebook.getClass(), gradebook.getId()); final GradeMapping mappingFromPersistence = gradebookFromPersistence.getSelectedGradeMapping(); // If the mapping has changed, and there are explicitly entered // course grade records, disallow this update. if (!mappingFromPersistence.getId().equals(gradebook.getSelectedGradeMapping().getId())) { if(isExplicitlyEnteredCourseGradeRecords(gradebook.getId())) { throw new IllegalStateException("Selected grade mapping can not be changed, since explicit course grades exist."); } } // Evict the persisted objects from the session and update the gradebook // so the new grade mapping is used in the sort column update //session.evict(mappingFromPersistence); for (final Object element : gradebookFromPersistence.getGradeMappings()) { session.evict(element); } session.evict(gradebookFromPersistence); try { session.update(gradebook); session.flush(); } catch (final StaleObjectStateException e) { throw new StaleObjectModificationException(e); } return null; }; getHibernateTemplate().execute(hc); }
final GradeMapping gradeMap= thisGradebook.getSelectedGradeMapping();
@Override public String getGradebookDefinitionXml(final String gradebookUid) { final Long gradebookId = getGradebook(gradebookUid).getId(); final Gradebook gradebook = getGradebook(gradebookUid); final GradebookDefinition gradebookDefinition = new GradebookDefinition(); final GradeMapping selectedGradeMapping = gradebook.getSelectedGradeMapping(); gradebookDefinition.setSelectedGradingScaleUid(selectedGradeMapping.getGradingScale().getUid()); gradebookDefinition.setSelectedGradingScaleBottomPercents(new HashMap<>(selectedGradeMapping.getGradeMap())); gradebookDefinition.setAssignments(getAssignments(gradebookUid)); gradebookDefinition.setGradeType(gradebook.getGrade_type()); gradebookDefinition.setCategoryType(gradebook.getCategory_type()); gradebookDefinition.setCategory(getCategories(gradebookId)); return VersionedExternalizable.toXml(gradebookDefinition); }
final GradeMapping selectedGradeMapping = gradebook.getSelectedGradeMapping(); if (selectedGradeMapping != null) {
final GradeMapping selectedGradeMapping = gradebook.getSelectedGradeMapping(); if(selectedGradeMapping!=null) {
final Map<String, Double> gradingSchema = gb.getSelectedGradeMapping().getGradeMap();
final Map<String, Double> gradingSchema = gb.getSelectedGradeMapping().getGradeMap();