aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <lemon@matthewlemon.com>2020-08-05 16:43:28 +0100
committerMatthew Lemon <lemon@matthewlemon.com>2020-08-05 16:43:28 +0100
commit65d1a7d85ab4a18c4f3ac0fc98bb5fb969ccc020 (patch)
tree0053dfb9eabe87327b8df8b806a4389d13002603
parentb11d2b8ed71a474066878d172b21d41bd7584d96 (diff)
added some comments re storing cell numfmt strings
-rw-r--r--pkg/datamaps/db.go1
-rw-r--r--pkg/datamaps/reader.go5
-rw-r--r--pkg/datamaps/writer.go1
3 files changed, 7 insertions, 0 deletions
diff --git a/pkg/datamaps/db.go b/pkg/datamaps/db.go
index d0f957e..a72a63c 100644
--- a/pkg/datamaps/db.go
+++ b/pkg/datamaps/db.go
@@ -235,6 +235,7 @@ func importXLSXtoDB(dmName string, returnName string, file string, db *sql.DB) e
log.Println(err.Error())
}
+ // TODO - here we need to store the c.NumFmt string value in a new field
insertStmt, err := db.Prepare("insert into return_data (dml_id, ret_id, filename, value) values(?,?,?,?)")
if err != nil {
log.Fatal(err)
diff --git a/pkg/datamaps/reader.go b/pkg/datamaps/reader.go
index b6e43e8..cda52ab 100644
--- a/pkg/datamaps/reader.go
+++ b/pkg/datamaps/reader.go
@@ -125,6 +125,11 @@ func cellVisitor(c *xlsx.Cell) error {
x, y := c.GetCoordinates()
cellref := xlsx.GetCellIDStringFromCoords(x, y)
+ // TODO: we need to store the c.NumFmt value here in the
+ // database so we can reply it again when we write the values
+ // to the master or elsewhere. We should keep the value itself
+ // in its unformatted state - i.e a date being something like 488594.
+
ex := extractedCell{
Cell: c,
Value: c.Value,
diff --git a/pkg/datamaps/writer.go b/pkg/datamaps/writer.go
index 6c28ff4..612fb74 100644
--- a/pkg/datamaps/writer.go
+++ b/pkg/datamaps/writer.go
@@ -116,6 +116,7 @@ func CreateMaster(opts *Options) error {
continue
}
dmlKey := datamapKeys[masterRow-1]
+ // TODO - we need to format the cells here too, e.g. dates
if sl := r.WriteSlice(append([]string{dmlKey}, values[dmlKey]...), -1); sl == -1 {
log.Printf("not a slice type")
}