Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
fixed parser and transaction issue
Browse files Browse the repository at this point in the history
  • Loading branch information
dreske committed Sep 29, 2021
1 parent 9d539aa commit 8a905db
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/api/model/centers.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ func (EditCenterDTO) MapFromDomain(center domain.Center) EditCenterDTO {
UserReference: center.UserReference,
Name: center.Name,
Website: center.Website,
Email: center.Email,
Address: center.Address,
OpeningHours: center.OpeningHours,
AddressNote: center.AddressNote,
Expand Down
2 changes: 1 addition & 1 deletion src/repositories/centers.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (r *centersRepository) Delete(ctx context.Context, center domain.Center) er

func (r *centersRepository) FindByUUID(ctx context.Context, uuid string) (domain.Center, error) {
var center domain.Center
err := r.db.Model(&domain.Center{}).
err := r.GetTX(ctx).Model(&domain.Center{}).
Preload("Operator").
Where("uuid = ?", uuid).
First(&center).Error
Expand Down
5 changes: 3 additions & 2 deletions src/services/csvparser.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ func (c *CsvParser) Parse(reader io.Reader) ([]ImportCenterResult, error) {
// error (EOF) will be catched in the next iteration
_, _ = csvReader.Read()
break
} else if v == "Partner ID" {
headerFound = true
fieldOffset = i
}
}
continue
Expand Down Expand Up @@ -144,8 +147,6 @@ func (c *CsvParser) parseCsvRow(entry []string) ImportCenterResult {
var website *string
if entry := strings.TrimSpace(entry[websiteIndex]); entry != "" && strings.ToLower(entry) != "null" {
website = &entry
} else {
result.Errors = append(result.Errors, "invalid email address: "+entry)
}

var email *string
Expand Down

0 comments on commit 8a905db

Please sign in to comment.