[REQUEST] bulk cleanup customer history
zandadoum opened this issue · 28 comments
Hello,
I'd like to ask for a couple options to bulk clean customer history with 3 options:
-
by days: bulk delete every customer history that didnt have activity/messages for past X days (if timestamp wasnt recorded in previsou version, maybe implement it for the future)
-
by tip: bulk delete every customer history that tipped less than X gold
-
a combination of 1+2: bulk delete every customer history older than X days that tipped less than Y
thank you!
@clery
Since you introduced the module do you want to work on that? otherwise I'll take a look at some point
Hey @derfloh205, sorry these days I really lack the time 😕 But it is an interesting feature 😄
Hey @derfloh205, sorry these days I really lack the time 😕 But it is an interesting feature 😄
No problem I feel you! :D
Then Ill look at this at some day
12.0.0 will introduce a bulk delete for all customers with 0 tip, more options may come in future updates :)
@clery I have a question regarding the customer history. Where does ace save the db to ? the saved variable seems to be different than what can be found in the .db property of the ace addon
From what I can see and recall, it’s in WTF/Account/AccountName/SavedVariables/CraftSim.lua
Within this file it’s in a variable called CraftSimCustomerHistory
Hope it helps !
@clery
ah ok, I thought of that but could not find anything ingame when /dump or /tinspect on it hmm
I just need to know the structure of it so I can migrate a player's data to my new structure
Do you happen to have some data you can share?
Otherwise I can also just test with alts
Yeah so I was a bit of an idiot. I was comparing strings for version comparison in the migration code (which obviously couldn't work). I suppose it could've created some issues since the 10.0.0+ version of CraftSim !
Hope it helps
@clery also it seems your migration function always cleared the saved variable 🤔 I cant really seem to understand the code there
Hey @derfloh205
So here's an example of what data may look like
CraftSimCustomerHistory = {
["profileKeys"] = {
["Rakhnar - Dalaran"] = "Default",
},
["realm"] = {
["Dalaran"] = {
["lastCustomer"] = "Clientname-Servername",
["Clientname-Servername"] = {
["totalTip"] = 70000000,
["history"] = {
{
["to"] = "Message to customer 1",
["timestamp"] = 1684509157045,
}, -- [1]
{
["from"] = "Answer from client 1",
["timestamp"] = 1684509209388,
}, -- [2]
{
["to"] = "Message to customer 2",
["timestamp"] = 1684509223438,
}, -- [3]
{
["crafted"] = "|cffa335ee|Hitem:193000::::::::70:260::13:8:8836:8840:8902:8780:9405:8791:9373:9366:8:28:2164:29:49:30:32:38:8:40:259:49:194578:50:204682:51:204440:::::|h[Ring-Bound Hourglass |A:Professions-ChatIcon-Quality-Tier5:17:17::1|a]|h|r",
["timestamp"] = 1684509301251,
["commission"] = 70000000,
["reagents"] = {
{
["isBasicReagent"] = true,
["reagent"] = {
["quantity"] = 2,
["itemID"] = 192836,
["dataSlotIndex"] = 1,
},
["source"] = 0,
["reagentSlot"] = 1,
}, -- [1]
{
["isBasicReagent"] = true,
["reagent"] = {
["quantity"] = 1,
["itemID"] = 192871,
["dataSlotIndex"] = 2,
},
["source"] = 0,
["reagentSlot"] = 2,
}, -- [2]
{
["isBasicReagent"] = true,
["reagent"] = {
["quantity"] = 1,
["itemID"] = 193379,
["dataSlotIndex"] = 3,
},
["source"] = 0,
["reagentSlot"] = 3,
}, -- [3]
{
["isBasicReagent"] = true,
["reagent"] = {
["quantity"] = 3,
["itemID"] = 193370,
["dataSlotIndex"] = 4,
},
["source"] = 0,
["reagentSlot"] = 4,
}, -- [4]
{
["isBasicReagent"] = false,
["reagent"] = {
["quantity"] = 1,
["itemID"] = 194578,
["dataSlotIndex"] = 7,
},
["source"] = 0,
["reagentSlot"] = 7,
}, -- [5]
{
["isBasicReagent"] = false,
["reagent"] = {
["quantity"] = 1,
["itemID"] = 204682,
["dataSlotIndex"] = 8,
},
["source"] = 1,
["reagentSlot"] = 8,
}, -- [6]
{
["isBasicReagent"] = false,
["reagent"] = {
["quantity"] = 1,
["itemID"] = 204440,
["dataSlotIndex"] = 9,
},
["source"] = 1,
["reagentSlot"] = 9,
}, -- [7]
},
}, -- [4]
{
["to"] = "Message to customer 3",
["timestamp"] = 1684509305521,
}, -- [5]
{
["from"] = "Answer from customer 2",
["timestamp"] = 1684509316697,
}, -- [6]
},
},
},
},
}
Weird this migration clearing db 🤔 I've updated CraftSim regularly since then and haven't got any data loss.
But there is indeed something weird, there should be a "version" field as well in there, which is missing, and could lead to migrations running everytime... not sure why though
Yeah so I was a bit of an idiot. I was comparing strings for version comparison in the migration code (which obviously couldn't work). I suppose it could've created some issues since the 10.0.0+ version of CraftSim ! Hope it helps
Yeah I found he culprit by testing ^^
I guess that means that all data has been cleared for all players that used it after 10.0.0?
Its bad yes but on the other hand.... I dont need to migrate any data to my version haha
Yeah so I was a bit of an idiot. I was comparing strings for version comparison in the migration code (which obviously couldn't work). I suppose it could've created some issues since the 10.0.0+ version of CraftSim ! Hope it helps
Its tricky tho, it sometimes works like 9.0.0 is lower than 10.0.0
but 7.10.9 will be greater than 9.9.9 xD
very wierd and a bit of a trap
I guess that means that all data has been cleared for all players that used it after 10.0.0? Its bad yes but on the other hand.... I dont need to migrate any data to my version haha
Actually I don’t think so, this morning as I was testing with 11.x.x yes there were some weird behaviors but I didn’t lose anything !
But hey you could still do a purge xD
I guess that means that all data has been cleared for all players that used it after 10.0.0? Its bad yes but on the other hand.... I dont need to migrate any data to my version haha
Actually I don’t think so, this morning as I was testing with 11.x.x yes there were some weird behaviors but I didn’t lose anything ! But hey you could still do a purge xD
hm thats even wierder, why is it gone for me tho ^^ and never saves
I guess that means that all data has been cleared for all players that used it after 10.0.0? Its bad yes but on the other hand.... I dont need to migrate any data to my version haha
Actually I don’t think so, this morning as I was testing with 11.x.x yes there were some weird behaviors but I didn’t lose anything ! But hey you could still do a purge xD
So you still have a lot of data?
Could you do me a favor? I would give you my current craftsim version with the new datastructure and the migration
in game you just run
/tinspect CraftSimCustomerHistoryV2 and check if the data makes sense ^^
its pushed ^^ the newest commit on main
It does not delete any old data (yet ^^)
So, from what I can see the SaveVariable was not removed, but it looks like DB is not loading properly and looks empty 😮
So, from what I can see the SaveVariable was not removed, but it looks like DB is not loading properly and looks empty 😮
hmm can you
/run CraftSimOptions.CustomerHistoryMigrationDone=false
and try again while looking at the debug for CUSTOMER_HISTORY?
ah thats a new method in GUTIL
do you have it local as a submodule?
https://github.com/derfloh205/GUTIL
Here's what I got
CustomerHistoryLegacy Migration failed:
...rface/AddOns/CraftSim/Modules/CustomerHistory/DB.lua:87: attempt to call method 'TrimTable' (a nil value)
Are you still using AceDB ? I can't seem do find any reference to it
Although I still can't seem to look at the history from the Custom History frame, but I'm guessing it's still WIP 😄
Oh right, I missed an error when I pulled.
Well it looks great ! Did some basic tests, send myself messages, completing a crafting order, data looks nice and complete 😄
Not sure if that's normal though The item link looks empty ? But it may just be an issue with the inspector
yes I also wondered xD thats an inspector thing, the itemlink is there!
the UI is WIP :D it was just about the data migration so that your old data is converted into new without issue :)
thank you so much for testing <3
It’s my pleasure ! Thanks for improving the customer history man ❤️
Thank YOU for initially creating it :D