| View previous topic :: View next topic |
| Author |
Message |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Fri Feb 12, 2021 8:17 am Post subject: |
|
|
They are used to increase or decrease the karma based on the time it has been set.
Here is the code with my comments:
| Code: |
# $kutime is the actual timestamp
# the modification time (modtime) will be set to $kutime when a record is updated
set kutime [clock seconds]
# $xtime is 90 days before
set xtime [expr $kutime - (90 * 86400)]
# delete all karmas which are locked and with a small value (between -1 and 1) and older than 90 days
kdb eval {DELETE FROM lkarma WHERE modtime < $xtime AND karma between -1 and 1 and locked='N'}
# decrease the value of positives karma and increase the value of negative karma
# if they are between 2 and 22 (positive or negative) and older than 90 days
kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $xtime AND karma between 2 and 22 AND locked='N'}
kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $xtime AND karma between -22 and -2 AND locked='N'}
# $ytime is 30 days before
set ytime [expr $kutime - (30 * 86400)]
# decrease the value of positives karma and increase the value of negative karma
# if they are between 23 and 54 (positive or negative) and older than 30 days
kdb eval {UPDATE lkarma SET karma=karma-1, modtime=$kutime WHERE modtime < $ytime AND karma between 23 and 54 AND locked='N'}
kdb eval {UPDATE lkarma SET karma=karma+1, modtime=$kutime WHERE modtime < $ytime AND karma between -54 and -23 AND locked='N'}
#... and doing the same with diffrent delays and karma values
## older than 7days and between 55 and 80
## older than 2 days and between 81 and 120
## older than 1 day and between 121 and 540
## older than 8 hours (1 day / 3) and between 541 and 959
## older than 4h48 (1 day / 5) and higher than 960
|
The goal seems to be to make the karma going to 0 when it has not been modified for a time. Lesser (positive or negative) is your karma and slower it will decrease (tend to 0) _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
geek Voice
Joined: 24 Oct 2008 Posts: 37
|
Posted: Fri Feb 12, 2021 1:35 pm Post subject: |
|
|
| CrazyCat wrote: | | The goal seems to be to make the karma going to 0 when it has not been modified for a time. Lesser (positive or negative) is your karma and slower it will decrease (tend to 0) |
now I understand
thanks man! |
|
| Back to top |
|
 |
|