Skip to content

Commit 8277368

Browse files
committed
use current time as the seed
1 parent 975e829 commit 8277368

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

scripts/allocate_funds.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
from argparse import ArgumentParser
2-
import os
32
import shlex
43
import subprocess
54
from datetime import date
6-
import json
5+
import time
76

87
from sdg_utils import get_all_issues, parse_issue, combine_projects_rounds
98
from project_selection import select_proposals_to_fund
@@ -12,7 +11,11 @@ def allocate_funds(issues, budget, funding_limit, seed=None):
1211

1312
proposals = [(issue['project_name'], issue['amount_requested'], issue['funded_amount']) for issue in issues]
1413
funded = select_proposals_to_fund(budget, funding_limit, proposals, seed=seed)
15-
14+
print('-' * 60)
15+
print("Funded projects:")
16+
for project in funded:
17+
print(f"- {project}")
18+
print('-' * 60)
1619
for issue in issues:
1720
if issue['project_name'] in funded:
1821
command = f'gh issue edit {issue["issue_number"]} --add-label "funded"'
@@ -35,15 +38,13 @@ def main():
3538
sdg_issues.append(result)
3639
sdg_issues_round = [sdg for sdg in sdg_issues if sdg['round_number'] == arguments.round and
3740
sdg['year'] == date.today().year and
38-
not sdg['awarded']]
41+
not sdg['awarded']]
3942
#Filter only this year and combine to calculate all they've been funded ask
4043
sdg_prev_rounds = [sdg_p for sdg_p in sdg_issues if sdg_p['round_number'] != arguments.round and sdg_p['year'] == date.today().year]
41-
print("only this round")
4244
combine_projects_rounds(sdg_issues_round, sdg_prev_rounds)
43-
seed = int(f"{date.today():%d%w%j}{arguments.round}")
45+
seed = int(time.time())
46+
print(f"Using seed: {seed}")
4447
allocate_funds(sdg_issues_round, arguments.budget, arguments.funding_limit, seed=seed)
4548

4649
if __name__ == "__main__":
4750
main()
48-
49-

0 commit comments

Comments
 (0)