Fixed for change in data output

This commit is contained in:
2021-11-09 15:10:04 -06:00
parent 2116778276
commit e19a630a8b
6 changed files with 11 additions and 8 deletions

BIN
data.xlsx

Binary file not shown.

2
go.mod
View File

@@ -3,12 +3,12 @@ module github.com/robviren/xl
go 1.17
require (
github.com/jmoiron/sqlx v1.3.4
github.com/mattn/go-sqlite3 v1.14.8
github.com/xuri/excelize/v2 v2.4.1
)
require (
github.com/jmoiron/sqlx v1.3.4 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/richardlehane/mscfb v1.0.3 // indirect
github.com/richardlehane/msoleps v1.0.1 // indirect

2
go.sum
View File

@@ -1,8 +1,10 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-sql-driver/mysql v1.5.0 h1:ozyZYNQW3x3HtqT1jira07DN2PArx2v7/mN66gGcHOs=
github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LBy8hT2VhHyBg=
github.com/jmoiron/sqlx v1.3.4 h1:wv+0IJZfL5z0uZoUjlpKgHkgaFSYD+r9CfrXjEXsO7w=
github.com/jmoiron/sqlx v1.3.4/go.mod h1:2BljVx/86SuTyjE+aPYlHCTNvZrnJXghYGpNiXLBMCQ=
github.com/lib/pq v1.2.0 h1:LXpIM/LZ5xGFhOpXAQUIMM1HdyqzVYM13zNdjCEEcA0=
github.com/lib/pq v1.2.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
github.com/mattn/go-sqlite3 v1.14.8 h1:gDp86IdQsN/xWjIEmr9MF6o9mpksUgh0fu+9ByFxzIU=

View File

@@ -1,5 +1,5 @@
package runner
func (r *Runner) DescriptionTYD(description string) []Data {
// func (r *Runner) DescriptionTYD(description string) []Data {
}
// }

View File

@@ -44,10 +44,10 @@ func (r *Runner) ProcessExcel(path string) {
data := []Data{}
for i, row := range rows {
if i >= offset {
new_data := Data{SKU: row[33], Level2: row[29], Level3: row[30], Description: row[44]}
new_data := Data{SKU: row[34], Level2: row[30], Level3: row[31], Description: row[45]}
//Parse Rev
rev, err := strconv.ParseFloat(row[72], 64)
rev, err := strconv.ParseFloat(row[75], 64)
checkErr(err)
new_data.Revenue = rev
@@ -57,12 +57,12 @@ func (r *Runner) ProcessExcel(path string) {
new_data.Cost = cost
//Parse Quantity
qty, err := strconv.ParseInt(row[71], 10, 64)
qty, err := strconv.ParseInt(row[74], 10, 64)
checkErr(err)
new_data.Quantity = qty
//Parse Time
day, err := time.Parse("2006-01", row[26])
day, err := time.Parse("2006-01", row[27])
checkErr(err)
new_data.Year = int64(day.Year())
new_data.Month = int64(day.Month())

View File

@@ -7,5 +7,6 @@ CREATE TABLE IF NOT EXISTS data (
cost float,
quantity integer,
year integer,
month integer
month integer,
trend float
);