Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Support another forecast data
Browse files Browse the repository at this point in the history
  • Loading branch information
spiegel-im-spiegel committed Jun 12, 2021
1 parent e0f6677 commit a2d1071
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion entity/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ type Entity struct {
}

func Decode(elements []string) (*Entity, error) {
if len(elements) != CSVCols {
if len(elements) < CSVCols {
return nil, errs.Wrap(ecode.ErrInvalidRecord)
}
return &Entity{
Expand Down
3 changes: 2 additions & 1 deletion fetch/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ import (
//Import function returns slice of entity.Entity
func Import(r io.Reader, f *filter.Filter) ([]*entity.Entity, error) {
list := entity.NewList(nil)
cr := csvdata.New(r, true).WithFieldsPerRecord(entity.CSVCols)
//cr := csvdata.New(r, true).WithFieldsPerRecord(entity.CSVCols)
cr := csvdata.New(r, true)
for {
if err := cr.Next(); err != nil {
if errs.Is(err, io.EOF) {
Expand Down
1 change: 1 addition & 0 deletions values/date/date.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var (
defaultDateForm = "2006-01-02"
timeTemplate = []string{
defaultDateForm,
"2006-01-02 15:04:05 MST",
time.RFC3339,
}
Zero = FromTime(time.Time{}) //Zero value of Date
Expand Down
1 change: 1 addition & 0 deletions values/date/date_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func TestUnmarshal(t *testing.T) {
str string
jsn string
}{
{s: `{"date_taken": "2005-03-26 00:00:00 UTC"}`, str: "2005-03-26", jsn: `{"date_taken":"2005-03-26"}`},
{s: `{"date_taken": "2005-03-26T00:00:00+09:00"}`, str: "2005-03-26", jsn: `{"date_taken":"2005-03-26"}`},
{s: `{"date_taken": "2005-03-26"}`, str: "2005-03-26", jsn: `{"date_taken":"2005-03-26"}`},
{s: `{"date_taken": ""}`, str: "", jsn: `{"date_taken":""}`},
Expand Down

0 comments on commit a2d1071

Please sign in to comment.