xls importer needs to handle integer data

Bug #362014 reported by Jason Straw
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SchoolTool
Fix Released
High
Gediminas Paulauskas

Bug Description

spreadsheet programs hate making numbers into text (see below) and therefore xldr thinks they are numbers (and therefore floats). Given that 1200 != 1200.0 you get a KeyError on importing if your usernames are integers and you try to add them to a group.

17:57:44 < ignas> yes
17:58:03 < ignas> did not expect gnumeric and oocalc not handling the "This is
                  TEXT not NUMBER" thing
17:59:19 < ignas> ok
17:59:26 < ignas> excel does not do that properly too
17:59:41 < ignas> they seem over cautious about treating numbers as text

Tags: import
Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Probably the best thing is profuse warnings on the import form and the spreadsheet itself.

Changed in schooltool:
assignee: nobody → Alan Elkner (aelkner)
importance: Undecided → High
milestone: none → next
status: New → Triaged
Alan Elkner (aelkner)
Changed in schooltool:
status: Triaged → Fix Committed
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

Where is the fix committed? I expect this is a problem even in the latest trunk with lp:~aelkner/schooltool/importer_fixes merged.

What sheet and values does this bug affect? Only usernames in Persons sheet? Numbers as usernames is an edge case. As I remember from testing, if SchoolYear ID is e.g. "2010", you may get an error "not unicode or ascii string". But I was able to avoid the error by changing the format of the cells from number to default.

getTextFoundValid method throws an error if it gets a number. But since we know there should be text, we could return unicode(value) anyway. Or this may produce u'1200.0' when u'1200' is expected?

Changed in schooltool:
assignee: Alan Elkner (aelkner) → Douglas Cerna (replaceafill)
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

Importer needs to be smarter when a number is expected or entered.

Changing cell formats in the spreadsheet is hard and unreliable.

Changed in schooltool:
status: Fix Committed → New
Changed in schooltool:
status: New → Triaged
Changed in schooltool:
status: Triaged → Fix Released
status: Fix Released → Triaged
Revision history for this message
Alan Elkner (aelkner) wrote :

This bug has gone through many status changes it seems. I tested the latest code with putting a number in a cell like a person id, and it catches the error just fine.

 I'm marking this bug as Invalid because I believe it is not possible to reproduce. If I change it to Fix Commited, then Gediminas is only going to ask me what revision the fix was made in. Problem is, that was so long ago, and I don't know anymore, so we need to let this one go away and only come back as a new bug if ever found again.

Changed in schooltool:
status: Triaged → Invalid
Revision history for this message
Tom Hoffman (tom-hoffman) wrote :

Stop marking bugs invalid Alan. What you should do in this case is just try to reproduce it against the packaged SchoolTool as well, and if it is fixed there, then it is fixed released. If not, we have to figure out where the commit is.

Changed in schooltool:
status: Invalid → Fix Committed
Changed in schooltool:
status: Fix Committed → Triaged
assignee: Douglas Cerna (replaceafill) → Gediminas Paulauskas (menesis)
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

This was never fixed. Just try to add a row to Persons table with username 1. Or password. Or school year 2012.

School Years A4 not unicode or ascii string

Such an error message is completely incomprehensible to an average user. And hard to fix in the spreadsheet.

Should just treat the cell as text and not check its type.

Alan Elkner (aelkner)
Changed in schooltool:
status: Triaged → In Progress
Alan Elkner (aelkner)
Changed in schooltool:
status: In Progress → Fix Committed
Changed in schooltool:
milestone: next → 1.9.3
Revision history for this message
Gediminas Paulauskas (menesis) wrote :

Yes so aelkner and me finally fixed this, and it was a very small change :)

Changed in schooltool:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.