diff options
author | Matthew Lemon <matt@matthewlemon.com> | 2020-08-06 14:11:15 +0100 |
---|---|---|
committer | Matthew Lemon <matt@matthewlemon.com> | 2020-08-06 14:11:15 +0100 |
commit | 0bb7c2b3ac9f8bbc148c3fbfca59fe9f600babf6 (patch) | |
tree | 7af5a9ab1b7f377635ac25d2938d4f4545276f83 | |
parent | 8a4c985d232cdf21ec054d8c0d2fa42f581082dd (diff) |
tests passing but only with the help of a hack to solve DD/MM/YY
-rw-r--r-- | pkg/datamaps/db.go | 4 | ||||
-rw-r--r-- | pkg/datamaps/testdata/test_template.xlsm | bin | 9194 -> 9390 bytes | |||
-rw-r--r-- | pkg/datamaps/testdata/test_template.xlsx | bin | 9397 -> 9389 bytes | |||
-rw-r--r-- | pkg/datamaps/writer_test.go | 7 |
4 files changed, 8 insertions, 3 deletions
diff --git a/pkg/datamaps/db.go b/pkg/datamaps/db.go index d95bfd7..2a63a11 100644 --- a/pkg/datamaps/db.go +++ b/pkg/datamaps/db.go @@ -243,6 +243,10 @@ func importXLSXtoDB(dmName string, returnName string, file string, db *sql.DB) e } defer insertStmt.Close() + // Hack to fix bug in Libreoffice numformats for dates + if cellData.NumFmt == "DD/MM/YY" { + cellData.SetFormat("dd/mm/yy") + } fValue, err := cellData.FormattedValue() if err != nil { return err diff --git a/pkg/datamaps/testdata/test_template.xlsm b/pkg/datamaps/testdata/test_template.xlsm Binary files differindex 725805d..7681c04 100644 --- a/pkg/datamaps/testdata/test_template.xlsm +++ b/pkg/datamaps/testdata/test_template.xlsm diff --git a/pkg/datamaps/testdata/test_template.xlsx b/pkg/datamaps/testdata/test_template.xlsx Binary files differindex 52f6360..4b46dbb 100644 --- a/pkg/datamaps/testdata/test_template.xlsx +++ b/pkg/datamaps/testdata/test_template.xlsx diff --git a/pkg/datamaps/writer_test.go b/pkg/datamaps/writer_test.go index e16ce10..e168f8d 100644 --- a/pkg/datamaps/writer_test.go +++ b/pkg/datamaps/writer_test.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "os/exec" + "path/filepath" "strings" "testing" @@ -38,9 +39,9 @@ func TestWriteMaster(t *testing.T) { XLSXPath: "./testdata/", } - // defer func() { - // os.Remove(filepath.Join(opts.MasterOutPutPath, "master.xlsx")) - // }() + defer func() { + os.Remove(filepath.Join(opts.MasterOutPutPath, "master.xlsx")) + }() if err := DatamapToDB(&opts); err != nil { t.Fatalf("Unable to write datamap to database file because %v.", err) |