Skip to content

Commit

Permalink
Merge pull request #10 from datasektionen/fix-mungus-bungus
Browse files Browse the repository at this point in the history
tog bort bra kod som fungerade förut
  • Loading branch information
DouglasFischer authored Oct 16, 2024
2 parents 8b74a9e + 441dbdc commit b506e7e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/database/loader.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package database
import (
"database/sql"
"fmt"
"github.com/datasektionen/GOrdian/internal/excel"
"io"

"github.com/datasektionen/GOrdian/internal/excel"
)

func SaveBudget(fileReader io.Reader, db *sql.DB) error {
Expand Down Expand Up @@ -36,11 +37,6 @@ func SaveBudget(fileReader io.Reader, db *sql.DB) error {
return fmt.Errorf("error inserting budget lines in database: %v", err)
}

err = Close(db)
if err != nil {
return fmt.Errorf("error inserting budget in database: %v", err)
}

//fmt.Println(budgetLines)
//fmt.Println(budgetLines[0].CostCentreName)
return nil
Expand Down
2 changes: 2 additions & 0 deletions internal/database/postgres.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package database
import (
"database/sql"
"fmt"

_ "github.com/lib/pq"
)

Expand All @@ -23,6 +24,7 @@ func Connect(psqlconnString string) (*sql.DB, error) {
return db, nil
}

// unused for now
func Close(db *sql.DB) error {
err := db.Close()
if err != nil {
Expand Down
2 changes: 2 additions & 0 deletions internal/web/report.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func getCCList(db *sql.DB) ([]string, error) {
if err != nil {
return nil, fmt.Errorf("failed to get CCList from database: %v", err)
}
defer result.Close()

var CCList []string

Expand All @@ -120,6 +121,7 @@ func getReportLines(db *sql.DB, year string, cc string) ([]ReportLine, error) {
if err != nil {
return nil, fmt.Errorf("failed to get reportlines from database: %v", err)
}
defer result.Close()

var reportLines []ReportLine

Expand Down

0 comments on commit b506e7e

Please sign in to comment.