[gradebook2-dev] course grade display

Thomas Amsler tpamsler at ucdavis.edu
Wed Jan 5 16:02:07 PST 2011


Paul,

I was just looking at the getLetterGrade(...) method. You say that:

"It reads that first null value and it falls through some conditionals
just returning null for the displayGrade."

When I debug this, I don't see where the first null value could fall through.

Looking at:

Double mapVal = (Double) gradeMap.get(grade);
double m = mapVal == null ? 0d : mapVal.doubleValue();

I would assume that mapVal is null and then "m" is 0.

This would just ignore the first null in the lookup and then continue
to the "A".

Here is the code in question:

private String getLetterGrade(BigDecimal value, GradeMapping mapping) {

    if (value == null || mapping == null)
        return null;

    Map<String, Double> gradeMap = mapping.getGradeMap();
    Collection<String> grades = mapping.getGrades();

    if (gradeMap == null || grades == null)
        return null;

    for (Iterator<String> iter = grades.iterator(); iter.hasNext();) {
        String grade = iter.next();
        Double mapVal = (Double) gradeMap.get(grade);
        double m = mapVal == null ? 0d : mapVal.doubleValue();
        BigDecimal bigMapVal =
BigDecimal.valueOf(m).setScale(AppConstants.DISPLAY_SCALE,
RoundingMode.HALF_UP);

        if (bigMapVal != null && bigMapVal.compareTo(value) <= 0) {
            return grade;
        }
    }
    return null;
}


-- Thomas


On Tue, Jan 4, 2011 at 12:37 PM, Paul Dagnall
<dagnalpb at notes.udayton.edu> wrote:
> Thomas
> I figured out the cause of Course grade not displaying for us. It has to do
> with the grade scale. At our institution we do not use A+, D+, or D-, so
> sometime ago we removed those from the display.
> In class: Gradebook2ComponentServiceImpl.java, method: getLetterGrade, it's
> trying to resolve the calculation into a displayable fashion for the Course
> Grade column. Currently when it pulls the grading scale record into the
> "grades" list variable, we get the following:
> [null, A, A-, B+, B, B-, C+, C, C-, null, D, null, F]
> It reads that first null value and it falls through some conditionals just
> returning null for the displayGrade.
> If I switch to just letter grades (no + or -) the course grade displays just
> fine!
> Our GB_GRADING_SCALE_PERCENTS_T table does not contain entries for A+, D+,
> or D-.
> My thinking right now would be to modify the getLetterGrade method to skip
> null entries rather than returning null, BUT I'm sure somebody else has
> removed at least one of those letter grades at their site.
> Any suggestions to avoid the code change?
> Thank you!
>
> Paul Dagnall
> Web Developer
> University of Dayton
>
>
> On Tue, Dec 21, 2010 at 6:49 PM, Thomas Amsler <tpamsler at ucdavis.edu> wrote:
>>
>> I think to further track this down, can you capture the JSON that is
>> coming back from the rest call when the grid loads. You would have to
>> use FireBug in Firefox or "Inspect Elements" in Chrome.
>> -- Thomas
>>
>> On Mon, Dec 20, 2010 at 1:31 PM, Paul Dagnall
>> <dagnalpb at notes.udayton.edu> wrote:
>> > No problem. And thank you for looking into this for me. I really
>> > appreciate
>> > your time.
>> > -Paul
>> >
>> > Paul Dagnall
>> > Web Developer
>> > University of Dayton
>> >
>> >
>> > On Mon, Dec 20, 2010 at 4:23 PM, Thomas Amsler <tpamsler at ucdavis.edu>
>> > wrote:
>> >>
>> >> Paul,
>> >>
>> >> Do you mind emailing me a screen capture? I have tried various things
>> >> but am not able to reproduce it so far.
>> >> -- Thomas
>> >>
>> >> On Mon, Dec 20, 2010 at 11:27 AM, Paul Dagnall
>> >> <dagnalpb at notes.udayton.edu> wrote:
>> >> > Thomas
>> >> > I see no abnormalities in the tomcat.
>> >> > In sakai.properties I have the following:
>> >> > gb2.gradable.role.names=Student,access
>> >> > gb2.enabled.grade.types=points,percentages,letters
>> >> > I have attached the csv export. It's from a points based gradebook.
>> >> > Thank you.
>> >> > Paul Dagnall
>> >> > Web Developer
>> >> > University of Dayton
>> >> >
>> >> >
>> >> > On Mon, Dec 20, 2010 at 12:44 PM, Thomas Amsler
>> >> > <tpamsler at ucdavis.edu>
>> >> > wrote:
>> >> >>
>> >> >> A few more questions:
>> >> >>
>> >> >> - How did you setup the gradebook (points, percentages, letter
>> >> >> grade)?
>> >> >>
>> >> >> - Do you see any warnings/errors in the tomcat log?
>> >> >>
>> >> >> - Can you provide a screen capture, using test data?
>> >> >>
>> >> >> - Can you provide an export file (Tools --> Export --> Grades &
>> >> >> Structure --> as CSV (.csv)) using test data?
>> >> >>
>> >> >> - What gb2 sakai.properties are you using?
>> >> >>
>> >> >> Best,
>> >> >> -- Thomas
>> >> >>
>> >> >> On Mon, Dec 20, 2010 at 8:11 AM, Paul Dagnall
>> >> >> <dagnalpb at notes.udayton.edu> wrote:
>> >> >> > Hi Thomas
>> >> >> > I'm using GB2 1.3.0 and sakai 2.6. Calculated Course Grade and
>> >> >> > Grade
>> >> >> > Override display fine, but for both the Instructor and Student the
>> >> >> > Course
>> >> >> > Grade values just do not display.
>> >> >> > Thanks.
>> >> >> >
>> >> >> > Paul Dagnall
>> >> >> > Web Developer
>> >> >> > University of Dayton
>> >> >> >
>> >> >> >
>> >> >> > On Mon, Dec 20, 2010 at 11:07 AM, Thomas Amsler
>> >> >> > <tpamsler at ucdavis.edu>
>> >> >> > wrote:
>> >> >> >>
>> >> >> >> Paul,
>> >> >> >>
>> >> >> >> What version for Gradebook2 and Sakai are you using?
>> >> >> >>
>> >> >> >> Best,
>> >> >> >> -- Thomas
>> >> >> >>
>> >> >> >> On Mon, Dec 20, 2010 at 5:49 AM, Paul Dagnall
>> >> >> >> <dagnalpb at notes.udayton.edu> wrote:
>> >> >> >> > On my dev box (mysql) the values in the course grade column
>> >> >> >> > display,
>> >> >> >> > but
>> >> >> >> > when I move the code to an oracle box, they do not. Any ideas?
>> >> >> >> > Thank you!
>> >> >> >> >
>> >> >> >> > Paul Dagnall
>> >> >> >> > Web Developer
>> >> >> >> > University of Dayton
>> >> >> >> >
>> >> >> >> > _______________________________________________
>> >> >> >> > gradebook2-dev mailing list
>> >> >> >> > gradebook2-dev at collab.sakaiproject.org
>> >> >> >> > http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev
>> >> >> >> >
>> >> >> >> >
>> >> >> >
>> >> >> >
>> >> >
>> >> >
>> >
>> >
>
>


More information about the gradebook2-dev mailing list