qbcore-framework/qb-crypto

[BUG] crypto history

Ronald-0001 opened this issue · 1 comments

crypto history dos not update correctly
and should be change from

if Crypto.History[coin][4] then
    Crypto.History[coin][4] = {PreviousWorth = prevValue, NewWorth = currentValue}
else
    Crypto.History[coin][#Crypto.History[coin] + 1] = {PreviousWorth = prevValue, NewWorth = currentValue}
end

to something like

if Crypto.History[coin][4] then
    Crypto.History[coin][1] = {PreviousWorth = Crypto.History[coin][2].PreviousWorth, NewWorth = Crypto.History[coin][2].NewWorth}
    Crypto.History[coin][2] = {PreviousWorth = Crypto.History[coin][3].PreviousWorth, NewWorth = Crypto.History[coin][3].NewWorth}
    Crypto.History[coin][3] = {PreviousWorth = Crypto.History[coin][4].PreviousWorth, NewWorth = Crypto.History[coin][4].NewWorth}
    Crypto.History[coin][4] = {PreviousWorth = prevValue, NewWorth = currentValue}
else
    Crypto.History[coin][#Crypto.History[coin] + 1] = {PreviousWorth = prevValue, NewWorth = currentValue}
end

in the server/main.lua line 81

@Ronald-0001 feel free to test the above mentioned PR.