Skip to content

Commit

Permalink
Merge pull request #89 from j3camero/Scarrab-decayrate-120
Browse files Browse the repository at this point in the history
Decay rate 120
  • Loading branch information
Scarrab authored Nov 14, 2023
2 parents 0049c4c + 2191e80 commit d022cbf
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions consolidate-time-matrix-older-than-one-week.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ SELECT
tt.lo_user_id AS lo_user_id,
tt.hi_user_id AS hi_user_id,
SUM(tt.duration_seconds) AS duration_seconds,
SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, @one_week_ago, tt.t)) * tt.diluted_seconds) AS diluted_seconds
SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, @one_week_ago, tt.t)) * tt.diluted_seconds) AS diluted_seconds
FROM time_together AS tt
WHERE t < @one_week_ago
GROUP BY tt.lo_user_id, tt.hi_user_id
ORDER BY SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, @one_week_ago, tt.t)) * tt.diluted_seconds)
ORDER BY SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, @one_week_ago, tt.t)) * tt.diluted_seconds)
;

-- Delete the old records.
Expand Down
4 changes: 2 additions & 2 deletions consolidate-time-matrix.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ SELECT
tt.lo_user_id AS lo_user_id,
tt.hi_user_id AS hi_user_id,
SUM(tt.duration_seconds) AS duration_seconds,
SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds) AS diluted_seconds
SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds) AS diluted_seconds
FROM time_together AS tt
GROUP BY tt.lo_user_id, tt.hi_user_id
ORDER BY SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds)
ORDER BY SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds)
;

-- Delete the old records.
Expand Down
4 changes: 2 additions & 2 deletions discounted-time-matrix-16h.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
SELECT
tt.lo_user_id AS lo_user_id,
tt.hi_user_id AS hi_user_id,
SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds) AS discounted_diluted_seconds
SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds) AS discounted_diluted_seconds
FROM time_together AS tt
INNER JOIN users AS lo on lo.commissar_id = tt.lo_user_id
INNER JOIN users AS hi ON hi.commissar_id = tt.hi_user_id
WHERE lo.citizen IS TRUE AND hi.citizen IS TRUE
AND tt.t > NOW() - INTERVAL 16 HOUR
GROUP BY tt.lo_user_id, tt.hi_user_id
ORDER BY SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds)
ORDER BY SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds)
;
4 changes: 2 additions & 2 deletions discounted-time-matrix.sql
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
SELECT
tt.lo_user_id AS lo_user_id,
tt.hi_user_id AS hi_user_id,
SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds) AS discounted_diluted_seconds
SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds) AS discounted_diluted_seconds
FROM time_together AS tt
INNER JOIN users AS lo on lo.commissar_id = tt.lo_user_id
INNER JOIN users AS hi ON hi.commissar_id = tt.hi_user_id
WHERE lo.citizen IS TRUE AND hi.citizen IS TRUE
GROUP BY tt.lo_user_id, tt.hi_user_id
ORDER BY SUM(EXP(0.00000004456964896 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds)
ORDER BY SUM(EXP(0.00000006685447343 * TIMESTAMPDIFF(SECOND, NOW(), tt.t)) * tt.diluted_seconds)
;

0 comments on commit d022cbf

Please sign in to comment.