Revert "Added the currency_affinity field to the configuration"

This reverts commit 8319b33c00.
This commit is contained in:
2025-08-31 19:35:31 +01:00
parent 05047af0c3
commit 9bf5916938
4 changed files with 13 additions and 22 deletions
+5 -4
View File
@@ -1,6 +1,8 @@
# DOING # DOING
- Make the dec.Decimal fields in the database actually be numbers, only if we Adding the field `Calculated` to `Share` to avoid computing what each user owes
can keep the 2 decimal places everytime due to the fractional cents problem
Make a script for the current migration to compute the Calculated value with
our rules
# TODO # TODO
- [ ] On the categories page, add a column of how many times a given category is - [ ] On the categories page, add a column of how many times a given category is
@@ -8,7 +10,7 @@ used
- [ ] Multiple categories per expense - [ ] Multiple categories per expense
- [X] Make all the other items update/create page be like expenses - [X] Make all the other items update/create page be like expenses
- [ ] Ability to attach a document to an expense - [ ] Ability to attach a document to an expense
~~- [ ] Debts table~~ - [ ] Debts table
- [ ] Ability to export data in multiple formats and with a selection of columns - [ ] Ability to export data in multiple formats and with a selection of columns
- [ ] Migrate every column named "ExpenseSomething" to "ExpSomething" - [ ] Migrate every column named "ExpenseSomething" to "ExpSomething"
- [ ] Make the models just return errors and not do any handling themselves - [ ] Make the models just return errors and not do any handling themselves
@@ -20,7 +22,6 @@ used
- [ ] Rename this file - [ ] Rename this file
- [ ] Better UX when adding expenses on the payments and share values (default even split) - [ ] Better UX when adding expenses on the payments and share values (default even split)
- [ ] Verification popups for delete actions - [ ] Verification popups for delete actions
- [ ] Users (auth)
### Stack ### Stack
- Go - Go
-2
View File
@@ -4,5 +4,3 @@ dbpath: "./data/data.db"
dbsys: "sqlite3" dbsys: "sqlite3"
migrations_path: "file://expenses/db/migrations/" migrations_path: "file://expenses/db/migrations/"
mig_custom_scripts: "./expenses/db/migrations/custom/" mig_custom_scripts: "./expenses/db/migrations/custom/"
# How many decimal places the money we are working on has
currency_affinity: 2
+7 -15
View File
@@ -8,13 +8,12 @@ import (
) )
type Configuration struct { type Configuration struct {
AssetsDir string `yaml:"assets"` AssetsDir string `yaml:"assets"`
Port string `yaml:"port"` Port string `yaml:"port"`
DBSys string `yaml:"dbsys"` DBSys string `yaml:"dbsys"`
DBPath string `yaml:"dbpath"` DBPath string `yaml:"dbpath"`
MigrationsPath string `yaml:"migrations_path"` MigrationsPath string `yaml:"migrations_path"`
MigCustomScript string `yaml:"mig_custom_scripts"` MigCustomScript string `yaml:"mig_custom_scripts"`
CurrencyAffinity int32 `yaml:"currency_affinity"`
} }
var ( var (
@@ -25,9 +24,6 @@ var (
func GetInstance() *Configuration { func GetInstance() *Configuration {
once.Do(func() { once.Do(func() {
if instance != nil {
return
}
instance = &Configuration{} instance = &Configuration{}
instance.loadConfiguration() instance.loadConfiguration()
}) })
@@ -35,14 +31,10 @@ func GetInstance() *Configuration {
return instance return instance
} }
func SetConfPath(path string) { func SetConfig(path string) {
confPath = path confPath = path
} }
func SetConfiguration(config *Configuration) {
instance = config
}
func (c *Configuration) loadConfiguration() { func (c *Configuration) loadConfiguration() {
file, err := os.ReadFile(confPath) file, err := os.ReadFile(confPath)
if err != nil { if err != nil {
+1 -1
View File
@@ -45,7 +45,7 @@ func StartLuaVM() (*lua.LState, error) {
} }
func StartApp() error { func StartApp() error {
config.SetConfPath("./config.yaml") config.SetConfig("./config.yaml")
cfg := config.GetInstance() cfg := config.GetInstance()
migDB, err := openDB(cfg.DBSys, cfg.DBPath, "") migDB, err := openDB(cfg.DBSys, cfg.DBPath, "")