I try to do an application to save several lists at tinydb but I have a problem to save correct these lists in tinyDB
One of them are teams (strings) and the others are results (numbers).
I have a Listview to select a player so when select an option I read the lists of tinydb of this player.
At the operation view I have a text to put the team, and another buttons to set the results. In this View I have a button to add elements at these values at lists and then update tinyDB.
When I save this list at tinydb without exit to the view, I can save and its OK, but if I go to other view when I return to View to introduce information the list of teams it’s Ok but the others lists of results only has one the first value save it.
After a million proves I think that the problem is when I save the lists of numerics at tinyDB.
I do the same instructions for the list of teams and the rests… I don’t understand.
If you plan to update something in TinyDB, don't assume the matching global is equal to the TinyDB copy of it.
To be safe, refresh from TinyDB immediately before each update of a global list.
Thanks for the UltimateScoreKeeper, I think the main idea of this project it's the same of mine.
I think that the problem is:
While I add elements at list without retrieve of tinydb i have a correct list the numbers without decimals.
But if I retrieve the list of tinyDB, It returns a list the numbers but with decimals. Then when I try to add a number without decimals at list, It don't add.
What do you think? @ABG
Thanks!!
Are you in France, where commas are used as decimal points?
Also, consider reducing the number of global variables in your code, and refer to what's stored in TinyDB directly wherever possible. That reduces confusion as to what data is current.
I'm in Spain.
Thanks for the advice, but I think that I need one global variable for each list I have.
In my casse I have 1 list of teams and 3 lists for integer values.
Thanks