all repos — piggy @ aac7712a4650e29b43bbaec3b3ac295214a16367

Dead simple finance manager in Go, HTML and JS.

remove exchange attribute
Marco Andronaco andronacomarco@gmail.com
Sun, 06 Oct 2024 12:56:43 +0200
commit

aac7712a4650e29b43bbaec3b3ac295214a16367

parent

693d77e1f7f4d3cc8f8da2e000d408ec3b1950ac

4 files changed, 3 insertions(+), 9 deletions(-)

jump to
M src/app/init.gosrc/app/init.go

@@ -44,7 +44,7 @@ if bookmakersAmount == 0 {

InsertSampleData() } - err = DB.Model(&Bookmaker{}).Where(&Bookmaker{Exchange: true}).Pluck("id", &ExchangeIDs).Error + err = DB.Model(&Bookmaker{}).Where("default_commission > 0").Pluck("id", &ExchangeIDs).Error if err != nil { log.Println("could not get exchange ids: " + err.Error()) }

@@ -59,7 +59,7 @@ err = DB.Create(&Bookmaker{Name: "Second Bookmaker"}).Error

if err != nil { log.Fatal(err) } - err = DB.Create(&Bookmaker{Name: "Third Exchange", Exchange: true}).Error + err = DB.Create(&Bookmaker{Name: "Third Exchange", DefaultCommission: 450}).Error if err != nil { log.Fatal(err) }
M src/app/models.gosrc/app/models.go

@@ -10,7 +10,6 @@ CreatedAt time.Time `json:"created_at"`

UpdatedAt time.Time `json:"updated_at"` Name string `json:"name" gorm:"not null" ` - Exchange bool `json:"exchange" gorm:"not null" ` DefaultCommission uint `json:"default_commission" gorm:"not null"` }
M static/js/bookmakers-edit.jsstatic/js/bookmakers-edit.js

@@ -21,9 +21,6 @@

// bookmaker.name div.appendChild(newInputText("Name", bookmaker?.name, "bookmaker-name")); - // bookmaker.exchange - div.appendChild(newInputCheckbox("Exchange", bookmaker?.exchange, "bookmaker-exchange")); - // bookmaker.default_commission div.appendChild(newInputText("Commission", bookmaker?.default_commission, "bookmaker-default_commission"));

@@ -40,7 +37,6 @@ const node = document.getElementsByClassName("bookmaker")[0];

return { id: +node.getAttribute("data-id"), name: getInputValueFromNode(node, "bookmaker-name"), - exchange: getInputValueFromNode(node, "bookmaker-exchange"), default_commission: +getInputValueFromNode(node, "bookmaker-default_commission"), } }
M static/js/bookmakers.jsstatic/js/bookmakers.js

@@ -21,7 +21,7 @@ header.innerHTML = '';

table.innerHTML = ''; const tr = document.createElement('tr'); - const headers = ["ID", "Created", "Updated", "Name", "Exchange", "Commission"]; + const headers = ["ID", "Created", "Updated", "Name", "Commission"]; for (const header of headers) { const td = document.createElement('td');

@@ -40,7 +40,6 @@ bookmaker.id,

formatDate(bookmaker.created_at), formatDate(bookmaker.updated_at), bookmaker.name, - formatBoolean(bookmaker.exchange), bookmaker.default_commission, ];