Skip to content

Commit 8eb83dd

Browse files
GITC-448: fix bounty query and ensure jtbd runs every day once (gitcoinco#9538)
* fix bounty query and ensure jtbd runs every day once * Update grants_extra.py
1 parent 91a8284 commit 8eb83dd

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

app/grants/templatetags/grants_extra.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,9 @@ def modulo(num, val):
5757
int: The modulo of number and value.
5858
5959
"""
60-
61-
return num % val
60+
if num and val:
61+
return num % val
62+
return 0
6263

6364
@register.simple_tag
6465
def is_team_member(grant, profile):

app/perftools/management/commands/create_jtbd_cache.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ def create_jtbd_earn_cache():
5252
thirty_days_ago = timezone.now() - datetime.timedelta(days=30)
5353

5454
bounties = list(Bounty.objects.filter(
55-
network='mainnet', event=None, idx_status='open', created_on__gt=thirty_days_ago
55+
network='mainnet', event=None, idx_status='open', created_on__gt=thirty_days_ago,
56+
current_bounty=True
5657
).order_by('-_val_usd_db').extra(
5758
select={'val_usd_db': '_val_usd_db'}
5859
).values(

scripts/crontab

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,10 @@ PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/us
106106
30 * * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_gas_history >> /var/log/gitcoin/create_gas_history.log 2>&1
107107
0 19 * * 7 cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash vacuum >> /var/log/gitcoin/vacuum.log 2>&1
108108
2 */3 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_page_cache >> /var/log/gitcoin/create_page_cache.log 2>&1
109-
30 */3 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_jtbd_cache >> /var/log/gitcoin/create_jtbd_cache.log 2>&1
109+
110+
# every day at 6PM
111+
0 18 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_jtbd_cache >> /var/log/gitcoin/create_jtbd_cache.log 2>&1
112+
110113
1 */30 * * * cd gitcoin/coin; bash scripts/run_management_command_if_not_already_running.bash create_activity_cache >> /var/log/gitcoin/create_activity_cache.log 2>&1
111114

112115

0 commit comments

Comments
 (0)