[gradebook2-dev] some grades are missing when importing grades from .CSV files into GB2

Thomas Amsler tpamsler at ucdavis.edu
Tue Sep 14 16:59:58 PDT 2010


Kim,

Mike and I just spend some time debugging is issue. I think you are right on
that the strippedColumns array size needs to be equals "columns.length" and
not "columns.length - 1". Also, a couple lines down, the code protects
itself from a potential index out of bounds exception:

   if (n < strippedColumns.length)

  strippedColumns[n] = columns[i];

So the potential fix could be look like the following. Note I have also
taken out the "if (n < strippedColumns.length)" since this is not needed
anymore because strippedColumns equals the length of columns now.

String[] strippedColumns = new String[columns.length];

   int n = 0;


for (int i=0;i<columns.length;i++) {


    Integer columnNumber = Integer.valueOf(i);


    if (ieInfo.getIgnoreColumns().contains(columnNumber))

        continue;


    if (ieInfo.getCourseGradeFieldIndex() == i)

        continue;


    strippedColumns[n] = columns[i];


    n++;

}

Also, this problem doesn't show up if the CSV file is "well" formatted.

Best,
-- Thomas

On Tue, Sep 14, 2010 at 11:26 AM, Kim Huang <kimhuang at oit.rutgers.edu>wrote:

> so I changed
> String [] strippedColumns = new String[columns.length];
>
> It works on this case. I will comment on the jira for the solution if
> everyone oks with my proposal.
>
> Thanks,
> -Kim
>
> Kim Huang wrote:
> > The problem is in
> > ImportExportUtility.java, function : readInGradeDataFromImportFile
> > these lines:
> >
> -----------------------------------------------------------------------------
>
> > String[] strippedColumns = new String[columns.length - 1];
> > int n = 0;
> > for (int i=0;i<columns.length;i++) {
> > Integer columnNumber = Integer.valueOf(i);
> >
> > if (ieInfo.getIgnoreColumns().contains(columnNumber))
> > continue;
> >
> > if (ieInfo.getCourseGradeFieldIndex() == i)
> >
> > continue;
> >
> >
> > if (n < strippedColumns.length)
> > strippedColumns[n] = columns[i];
> > n++;
> > --------------------------------
> > for line "a6 at 1.com <mailto:a6 at 1.com>,a6 at 1.com <a6 at 1.com%3E,a6 at 1.com>
> > <mailto:a6 at 1.com>,88,,,,,," <a6 at 1.com%3E,88,,,,,,>, the size of columns
> is 8, so the size of
> > strippedColumns is defined as 7
> > the strippedColumns[n] = columns[i]; will execute , because n is 2 for
> > the grade "88" column,
> >
> > but for line "a7 at 1.com, a7 at 1.com,88", the size of columns is 3, so the
> > size of strippedColumns is defined as 2,
> > since n ==2 when the grade should be assigned, but if (n <
> > strippedColumns.length) returns false,
> > so the grade is not assigned.
> >
> > file Gradebook.csv looks perfectly normal when opened under Microsoft
> > excel , so I think a lot of faculties will have this type of the file
> > I don't know how important the size of strippedColumns in your code,
> > otherwise I will define it as the same size of columns
> >
> > Thanks,
> >
> > -Kim
> >
> >
> > Michael Wenk wrote:
> >
> >> I think the last 3 lines aren't being imported because they don't have
> >> all the columns the other lines have.
> >>
> >> Here are the last 4 lines:
> >>
> >> a6 at 1.com <mailto:a6 at 1.com>,a6 at 1.com <a6 at 1.com%3E,a6 at 1.com> <
> mailto:a6 at 1.com>,88 <a6 at 1.com%3E,88>,,,,,,
> >> a7 at 1.com <mailto:a7 at 1.com>,a7 at 1.com <a7 at 1.com%3E,a7 at 1.com> <
> mailto:a7 at 1.com>,88 <a7 at 1.com%3E,88>
> >> a8 at 1.com <mailto:a8 at 1.com>,a8 at 1.com <a8 at 1.com%3E,a8 at 1.com> <
> mailto:a8 at 1.com>,88 <a8 at 1.com%3E,88>
> >> a9 at 1.com <mailto:a9 at 1.com>,a9 at 1.com <a9 at 1.com%3E,a9 at 1.com> <
> mailto:a9 at 1.com>,88 <a9 at 1.com%3E,88>
> >>
> >>
> >> I need to run it thru hosted mode to be fully sure, but I strongly
> >> suspect this is the problem...
> >>
> >> Mike
> >>
> >> On Tue, Sep 14, 2010 at 5:27 AM, Kim Huang <kimhuang at oit.rutgers.edu
> >> <mailto:kimhuang at oit.rutgers.edu>> <kimhuang at oit.rutgers.edu%3E%3E>wrote:
> >>
> >> Thomas,
> >> Please find it at attachment. BTW, following the step stated in the
> >> previous email, you can re-create the problem easily.
> >> Thanks,
> >> -Kim
> >> Thomas Amsler wrote:
> >> > Kim,
> >> >
> >> > Could you please send us your CSV file that causes this issue?
> >> >
> >> > Best,
> >> > -- Thomas
> >> >
> >> > On Mon, Sep 13, 2010 at 9:36 AM, Thomas Amsler
> >> <tpamsler at ucdavis.edu <mailto:tpamsler at ucdavis.edu><tpamsler at ucdavis.edu%3E>
> >> > <mailto:tpamsler at ucdavis.edu>> <tpamsler at ucdavis.edu%3E%3E>
> >> <mailto:tpamsler at ucdavis.edu%3E%3E> <tpamsler at ucdavis.edu%3E%3E%3E>wrote:
> >> >
> >> > Thank you for reporting this. We will try to verify this as soon
> >> > as possible.
> >> > -- Thomas
> >> >
> >> >
> >> > On Mon, Sep 13, 2010 at 9:03 AM, Kim Huang
> >> > <kimhuang at oit.rutgers.edu <mailto:kimhuang at oit.rutgers.edu><kimhuang at oit.rutgers.edu%3E>
> >> <mailto:kimhuang at oit.rutgers.edu>> <kimhuang at oit.rutgers.edu%3E%3E>
> >> <mailto:kimhuang at oit.rutgers.edu%3E%3E><kimhuang at oit.rutgers.edu%3E%3E%3E>wrote:
> >> >
> >> > Thomas,
> >> > Thanks for your quick response. Here you go for the new jira -
> >> > GRBK-740
> >> >
> >> > http://jira.sakaiproject.org/browse/GRBK-740
> >> >
> >> > I am willing help debug if you can point to me roughly where
> >> > you think the problem could be.
> >> >
> >> > Thanks,
> >> > -Kim
> >> > Thomas Amsler wrote:
> >> >
> >> > Kim,
> >> >
> >> > Please create a GRBK JIRA for this.
> >> >
> >> > Best,
> >> > -- Thomas
> >> >
> >> > On Mon, Sep 13, 2010 at 8:26 AM, Kim Huang
> >> > <kimhuang at oit.rutgers.edu <mailto:kimhuang at oit.rutgers.edu><kimhuang at oit.rutgers.edu%3E>
> >> > <mailto:kimhuang at oit.rutgers.edu> <kimhuang at oit.rutgers.edu%3E>
> >> <mailto:kimhuang at oit.rutgers.edu%3E> <kimhuang at oit.rutgers.edu%3E%3E>
> >> > <mailto:kimhuang at oit.rutgers.edu <kimhuang at oit.rutgers.edu>
> >> > <mailto:kimhuang at oit.rutgers.edu>>><kimhuang at oit.rutgers.edu%3E%3E%3E>
> >> <mailto:kimhuang at oit.rutgers.edu%3E%3E%3E><kimhuang at oit.rutgers.edu%3E%3E%3E%3E>wrote:
> >> >
> >> > Hi, Folks,
> >> >
> >> > Found a serious issue of grades being truncated when
> >> > importing grades
> >> > from CSV file on Rutgers production server( GB2
> >> > -v1.2.0). Then I
> >> > reproduced it on one of the Sakai QA
> >> > servers(http://qa6-us.sakaiproject.org/portal). Please
> >> > help to confirm
> >> > whether this problem has been recorded/solved in jira.
> >> > Otherwise I
> >> > will
> >> > create a jira.
> >> >
> >> > When you import a class grades from .csv file, not all
> >> > the grades
> >> > in CSV
> >> > file are imported completed. Usually the last few (one
> >> > or two) entries
> >> > are missing. This problem only happens on .csv file,
> >> > XLS files
> >> > work just
> >> > fine.
> >> > It can be reproduced by the following steps:
> >> >
> >> > 1. create a new site, can be either project site or
> >> > course site.
> >> > 2. add about 16+ participants.
> >> > 3. add some new items in gradebook2, i.e. HW1, HW2,
> >> > HW3, etc
> >> > 4. first export the grades by clicking on
> >> > tools->export->grades &
> >> > structures->as .csv file
> >> > 5. edit the exported .csv file, added a grade to one
> >> > column for EVERY
> >> > student in the gradebook(i.e. add "88" for HW1 for 16
> >> > students, if you
> >> > have 16 students in this site.) save the file
> >> > 6. import the just saved .csv file by tools->import,
> >> > you will see from
> >> > preview data view, some grades are missing. usually the
> >> > last few
> >> > entries
> >> > are missing.
> >> >
> >> > (I investigated a little bit, the .csv file has been
> >> > read in
> >> > correctly,
> >> > which means, readInGradeDataFromImportFile in
> >> > ImportExportUtility.java
> >> > reads the complete whole set of grades from .csv file.)
> >> >
> >> > Thanks, Let me know if you have further question,
> >> >
> >> > -Kim Huang
> >> >
> >> >
> >> > _______________________________________________
> >> > gradebook2-dev mailing list
> >> > gradebook2-dev at collab.sakaiproject.org
> >> <mailto:gradebook2-dev at collab.sakaiproject.org><gradebook2-dev at collab.sakaiproject.org%3E>
> >> > <mailto:gradebook2-dev at collab.sakaiproject.org><gradebook2-dev at collab.sakaiproject.org%3E>
> >> <mailto:gradebook2-dev at collab.sakaiproject.org%3E><gradebook2-dev at collab.sakaiproject.org%3E%3E>
> >> > <mailto:gradebook2-dev at collab.sakaiproject.org<gradebook2-dev at collab.sakaiproject.org>
> >> > <mailto:gradebook2-dev at collab.sakaiproject.org>><gradebook2-dev at collab.sakaiproject.org%3E%3E>
> >> <mailto:gradebook2-dev at collab.sakaiproject.org%3E%3E><gradebook2-dev at collab.sakaiproject.org%3E%3E%3E>
> >> >
> >> >
> >> > http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev
> >> >
> >> >
> >> >
> >> >
> >> >
> >>
> >> [see attachment: "Gradebook(4) 08-21-52.csv", size: 562 bytes]
> >>
> >>
> >> Attachments:
> >>
> >> Gradebook(4) 08-21-52.csv
> >> <
> https://smartsite.ucdavis.edu/access/content/attachment/3f65bb14-6c93-4ee0-0064-af78c775d60a/_anon_/d528c861-74ab-46b6-b0f5-eecff503b3ce/Gradebook_4_%2008-21-52.csv><https://smartsite.ucdavis.edu/access/content/attachment/3f65bb14-6c93-4ee0-0064-af78c775d60a/_anon_/d528c861-74ab-46b6-b0f5-eecff503b3ce/Gradebook_4_%2008-21-52.csv%3E>
> >>
> >>
> >>
> >> ------------------------------------------------------------------------
>
> >>
> >> This automatic notification message was sent by SmartSite at UCDavis
> >> (https://smartsite.ucdavis.edu/xsl-portal) from the UCD Sakai Dev
> >> site.
> >> You can modify how you receive notifications at My Workspace >
> >> Preferences.
> >>
> >>
> >>
> >>
> >> --
> >> Michael Wenk
> >> mjwenk at ucdavis.edu <mailto:mjwenk at ucdavis.edu> <mjwenk at ucdavis.edu%3E>
> >>
> >
> > _______________________________________________
> > gradebook2-dev mailing list
> > gradebook2-dev at collab.sakaiproject.org
> > http://collab.sakaiproject.org/mailman/listinfo/gradebook2-dev
> >
>
> ------------------------------
>
> This automatic notification message was sent by SmartSite at UCDavis (
> https://smartsite.ucdavis.edu/xsl-portal) from the UCD Sakai Dev site.
> You can modify how you receive notifications at My Workspace > Preferences.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/gradebook2-dev/attachments/20100914/796b8403/attachment-0001.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GRBK-740.patch
Type: application/octet-stream
Size: 1055 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/gradebook2-dev/attachments/20100914/796b8403/attachment-0001.obj 


More information about the gradebook2-dev mailing list