Skip to content

Commit

Permalink
v1.0.2 skip unfinished lines
Browse files Browse the repository at this point in the history
  • Loading branch information
nixargh committed Aug 3, 2023
1 parent b98bb9c commit ea2f339
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# vendor/

# compiled binary
roly-poly-vpn
tired

# vim
*.sw?
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.0.2] - 2023-08-03
### Fixed
- Skip unfinished lines.

## [1.0.1] - 2023-08-02
### Fixed
- Don't split comment with `,` sign.
Expand Down
8 changes: 7 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
// "github.com/pkg/profile"
)

var version string = "1.0.1"
var version string = "1.0.2"

var clog *log.Entry

Expand Down Expand Up @@ -265,6 +265,12 @@ func parseWorkRecords(records []string) []WorkRecord {
wr.Issue = fields[3]
wr.Comment = strings.ReplaceAll(fields[4], "\"", "")

// Validations
if wr.Date == "" || wr.StartTime == "" || wr.EndTime == "" || wr.Issue == "" || wr.Comment == "" {
clog.WithFields(log.Fields{"record": wr}).Warning("Some fields are empty, skipping the record.")
continue
}

// Add duration
startDateTimeString := fmt.Sprintf("%s %s:00", wr.Date, wr.StartTime)
startDateTime, serr := time.ParseInLocation(time.DateTime, startDateTimeString, location)
Expand Down

0 comments on commit ea2f339

Please sign in to comment.