本文整理汇总了Java中org.sakaiproject.service.gradebook.shared.Assignment.getPoints方法的典型用法代码示例。如果您正苦于以下问题:Java Assignment.getPoints方法的具体用法?Java Assignment.getPoints怎么用?Java Assignment.getPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.sakaiproject.service.gradebook.shared.Assignment
的用法示例。
在下文中一共展示了Assignment.getPoints方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeGradebookItem
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
/**
* Remove an assignment using the external id to locate it,
* will only remove assignments which actually are externally managed by us
*
* @param gradebookId the gradebook unique id (can also be the siteId)
* @param externalId the external id for the assignment (must be externally controlled)
* @return the Assignment if found and removed OR null if not found and NOT removed
*/
public GradebookItem removeGradebookItem(String gradebookId, String externalId) {
GradebookItem removed = null;
Assignment a = findAssignmentByExternalId(gradebookId, externalId);
if (a != null) {
/* NOTES:
* (1) Removing the Assignment only does not work, adding external ones later will cause exceptions (externalId in use)
* gradebookService.removeAssignment(a.getId());
* (2) Breaking the connection only does not actually remove the Assignment
* gradebookExternalAssessmentService.setExternalAssessmentToGradebookAssignment(gradebookId, externalId);
* (3) The correct way which seems to remove the external assessment, Assignment, and scores is removeExternalAssessment
* gradebookExternalAssessmentService.removeExternalAssessment(gradebookId, externalId);
*/
gradebookExternalAssessmentService.removeExternalAssessment(gradebookId, externalId);
removed = new GradebookItem(gradebookId, a.getName(), a.getPoints(), a.getDueDate(), a.getCategoryName(), a.isReleased(), a.isCounted());
removed.id = a.getId();
removed.deleted = true;
}
return removed;
}
示例2: constructAverageLabel
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private String constructAverageLabel(final List<Double> allGrades, final Assignment assignment) {
final double average = calculateAverage(allGrades);
final String averageFormatted = FormatHelper.formatDoubleToDecimal(Double.valueOf(average));
if (GradingType.PERCENTAGE.equals(this.gradingType)) {
return (new StringResourceModel("label.percentage.valued",
null,
new Object[] { averageFormatted })).getString();
}
final Double total = assignment.getPoints();
final String percentage = FormatHelper.formatDoubleAsPercentage(100 * (average / total.doubleValue()));
return (new StringResourceModel("label.statistics.averagevalue",
null,
new Object[] { averageFormatted, FormatHelper.formatGrade(String.valueOf(total)), percentage })).getString();
}
示例3: constructMedianLabel
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private String constructMedianLabel(final List<Double> allGrades, final Assignment assignment) {
final double median = calculateMedian(allGrades);
final String medianFormatted = FormatHelper.formatDoubleToDecimal(Double.valueOf(median));
if (GradingType.PERCENTAGE.equals(this.gradingType)) {
return (new StringResourceModel("label.percentage.valued",
null,
new Object[] { medianFormatted })).getString();
}
final Double total = assignment.getPoints();
final String percentage = FormatHelper.formatDoubleAsPercentage(100 * (median / total.doubleValue()));
return (new StringResourceModel("label.statistics.medianvalue",
null,
new Object[] { medianFormatted, FormatHelper.formatGrade(String.valueOf(total)), percentage })).getString();
}
示例4: constructLowestLabel
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private String constructLowestLabel(final List<Double> allGrades, final Assignment assignment) {
final double lowest = Collections.min(allGrades);
final String lowestFormatted = FormatHelper.formatDoubleToDecimal(Double.valueOf(lowest));
if (GradingType.PERCENTAGE.equals(this.gradingType)) {
return (new StringResourceModel("label.percentage.valued",
null,
new Object[] { lowestFormatted })).getString();
}
final Double total = assignment.getPoints();
final String percentage = FormatHelper.formatDoubleAsPercentage(100 * (lowest / total.doubleValue()));
return (new StringResourceModel("label.statistics.lowestvalue",
null,
new Object[] { lowestFormatted, FormatHelper.formatGrade(String.valueOf(total)), percentage })).getString();
}
示例5: constructHighestLabel
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private String constructHighestLabel(final List<Double> allGrades, final Assignment assignment) {
final double highest = Collections.max(allGrades);
final String highestFormatted = FormatHelper.formatDoubleToDecimal(Double.valueOf(highest));
if (GradingType.PERCENTAGE.equals(this.gradingType)) {
return (new StringResourceModel("label.percentage.valued",
null,
new Object[] { highestFormatted })).getString();
}
final Double total = assignment.getPoints();
final String percentage = FormatHelper.formatDoubleAsPercentage(100 * (highest / total.doubleValue()));
return new StringResourceModel("label.statistics.highestvalue",
null,
new Object[] { highestFormatted, FormatHelper.formatGrade(String.valueOf(total)), percentage }).getString();
}
示例6: GradebookItem
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
public GradebookItem(Assignment assignment) {
this.id = assignment.getId();
this.name = assignment.getName();
this.points = assignment.getPoints();
this.dueDate = assignment.getDueDate();
if(assignment.isExternallyMaintained()) {
this.externalInfo = new ExternalInfo(assignment);
}
this.grades = new ArrayList<>();
this.categoryId = assignment.getCategoryId();
this.released = assignment.isReleased();
this.extraCredit = assignment.isExtraCredit();
}
示例7: makeGradebookItemFromAssignment
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private GradebookItem makeGradebookItemFromAssignment(String gbID, Assignment assignment,
Map<String, String> studentUserIds, ArrayList<String> studentIds) {
// build up the items listing
GradebookItem gbItem = new GradebookItem(gbID, assignment.getName(), assignment
.getPoints(), assignment.getDueDate(), assignment.getExternalAppName(),
assignment.isReleased(), assignment.isCounted());
gbItem.id = assignment.getId();
/*
* We have to iterate through each student and get the grades out...
* 2.6 gradebook service has some issues
*/
for (String studentId : studentIds) {
// too expensive: if (gradebookService.getGradeViewFunctionForUserForStudentForItem(gbID, assignment.getId(), studentId) == null) {
String grade = gradebookService.getAssignmentScoreString(gbID, assignment.getId(), studentId);
if (grade != null) {
GradebookItemScore score = new GradebookItemScore(assignment.getId().toString(),
studentId, grade );
score.username = studentUserIds.get(studentId);
CommentDefinition cd = gradebookService.getAssignmentScoreComment(gbID, assignment
.getId(), studentId);
if (cd != null) {
score.comment = cd.getCommentText();
score.recorded = cd.getDateRecorded();
score.graderUserId = cd.getGraderUid();
}
gbItem.scores.add(score);
}
}
/* This is another post 2.5 way
List<GradeDefinition> grades = gradebookService.getGradesForStudentsForItem(siteId,
assignment.getId(), studentIds);
for (GradeDefinition gd : grades) {
String studId = gd.getStudentUid();
String studEID = studentUserIds.get(studId);
GradebookItemScore score = new GradebookItemScore(assignment.getId().toString(),
studId, gd.getGrade(), studEID, gd.getGraderUid(), gd.getDateRecorded(),
gd.getGradeComment());
gbItem.scores.add(score);
}
**/
return gbItem;
}
示例8: GradeAssignmentItem
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
public GradeAssignmentItem(Assignment assignment) {
this.itemName = assignment.getName();
this.points = assignment.getPoints();
}
示例9: setUpGradeInformation
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private void setUpGradeInformation(String gradebookUid, String selAssignmentName, String studentId) {
GradebookService gradebookService = getGradebookService();
if (gradebookService == null) return;
Assignment assignment = gradebookService.getAssignmentByNameOrId(gradebookUid, selAssignmentName);
// first, check to see if user is authorized to view or grade this item in the gradebook
String function = gradebookService.getGradeViewFunctionForUserForStudentForItem(gradebookUid, assignment.getId(), studentId);
if (function == null) {
allowedToGradeItem = false;
selGBItemRestricted = true;
} else if (function.equalsIgnoreCase(GradebookService.gradePermission)) {
allowedToGradeItem = true;
selGBItemRestricted = false;
} else {
allowedToGradeItem = false;
selGBItemRestricted = false;
}
// get the grade entry type for the gradebook
int gradeEntryType = gradebookService.getGradeEntryType(gradebookUid);
if (gradeEntryType == GradebookService.GRADE_TYPE_LETTER) {
gradeByLetter = true;
gradeByPoints = false;
gradeByPercent = false;
} else if (gradeEntryType == GradebookService.GRADE_TYPE_PERCENTAGE) {
gradeByLetter = false;
gradeByPoints = false;
gradeByPercent = true;
} else {
gradeByLetter = false;
gradeByPoints = true;
gradeByPercent = false;
}
NumberFormat numberFormat = DecimalFormat.getInstance(new ResourceLoader().getLocale());
if (!selGBItemRestricted) {
if (assignment != null && assignment.getPoints() != null) {
gbItemPointsPossible = ((DecimalFormat) numberFormat).format(assignment.getPoints());
}
GradeDefinition gradeDef = gradebookService.getGradeDefinitionForStudentForItem(gradebookUid, assignment.getId(), studentId);
if (gradeDef.getGrade() != null) {
String decSeparator = FormattedText.getDecimalSeparator();
gbItemScore = StringUtils.replace(gradeDef.getGrade(), (",".equals(decSeparator)?".":","), decSeparator);
}
if (gradeDef.getGradeComment() != null) {
gbItemComment = gradeDef.getGradeComment();
}
setSelectedAssignForMessage(selAssignmentName);
} else {
resetGradeInfo();
setSelectedAssignForMessage(selAssignmentName);
}
}
示例10: isExtraCredit
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private boolean isExtraCredit(final Double grade, final Assignment assignment, final GradingType gradingType) {
return (GradingType.PERCENTAGE.equals(gradingType) && grade > 100) ||
(GradingType.POINTS.equals(gradingType) && grade > assignment.getPoints());
}
示例11: isExtraCredit
import org.sakaiproject.service.gradebook.shared.Assignment; //导入方法依赖的package包/类
private boolean isExtraCredit(final Double grade, final Assignment assignment) {
return (GradingType.PERCENTAGE.equals(this.gradingType) && grade > 100) ||
(GradingType.POINTS.equals(this.gradingType) && grade > assignment.getPoints());
}