-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtmp.py
55 lines (40 loc) · 1.35 KB
/
tmp.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import csv
from prizetap.models import LineaRaffleEntries, Raffle
# Initialize empty dictionary and lists
data_dict = {}
addresses = []
chances = []
# Read the CSV file and fill the dictionary and lists
with open("lin.csv", "r") as csv_file:
csv_reader = csv.reader(csv_file)
for row in csv_reader:
num = int(row[0])
address = row[1]
chance = int(row[2])
data_dict[num] = {"address": address, "chance": chance}
addresses.append(address)
chances.append(chance)
# Split lists into chunks of size 100
def split_list(input_list, chunk_size):
return [
input_list[i : i + chunk_size] for i in range(0, len(input_list), chunk_size)
]
addresses_chunks = split_list(addresses[369:], 100)
chances_chunks = split_list(chances[369:], 100)
for i in addresses_chunks:
print("[" + ",".join(i) + "]")
print("*****")
for i in chances_chunks:
print("[" + ",".join(map(str, i)) + "]")
print("*****")
# print(LineaRaffleEntries.objects.all().count())
print(len(data_dict))
def add_entries(data_dict):
linea_raffle = Raffle.objects.get(name="Linea Gas Pass")
for i in data_dict:
LineaRaffleEntries.objects.create(
wallet_address=data_dict[i]["address"],
raffle=linea_raffle,
)
# add_entries(data_dict)
print(LineaRaffleEntries.objects.all().count())