mirror of
https://github.com/TinyTapeout/tt-support-tools.git
synced 2026-11-03 04:36:09 +01:00
don't include refunded orders. check remote matches repo
This commit is contained in:
@@ -121,6 +121,11 @@ class Projects():
|
|||||||
self.projects.append(project)
|
self.projects.append(project)
|
||||||
|
|
||||||
# now do some sanity checks
|
# now do some sanity checks
|
||||||
|
for project in self.projects:
|
||||||
|
if project.get_git_remote() != project.git_url:
|
||||||
|
logging.warning(f"{project} doesn't match remote: {project.get_git_remote()}")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
all_macro_instances = [project.get_macro_instance() for project in self.projects]
|
all_macro_instances = [project.get_macro_instance() for project in self.projects]
|
||||||
self.assert_unique(all_macro_instances)
|
self.assert_unique(all_macro_instances)
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ class Orders():
|
|||||||
|
|
||||||
def fetch_orders(self):
|
def fetch_orders(self):
|
||||||
orders = self.fetch_stripe_orders() + self.fetch_university_orders() + self.fetch_extra_orders()
|
orders = self.fetch_stripe_orders() + self.fetch_university_orders() + self.fetch_extra_orders()
|
||||||
|
logging.info(f"total = {len(orders)}")
|
||||||
self.orders = sorted(orders, key=lambda d: d['time'])
|
self.orders = sorted(orders, key=lambda d: d['time'])
|
||||||
|
|
||||||
def add_extra_project(self, git_url):
|
def add_extra_project(self, git_url):
|
||||||
@@ -90,14 +91,17 @@ class Orders():
|
|||||||
if checkout['payment_status'] == 'paid':
|
if checkout['payment_status'] == 'paid':
|
||||||
if 'github' in checkout['metadata']:
|
if 'github' in checkout['metadata']:
|
||||||
git_url = checkout['metadata']['github']
|
git_url = checkout['metadata']['github']
|
||||||
|
|
||||||
|
if checkout['payment_intent'] in refunded_orders:
|
||||||
|
logging.warning(f"found a refunded order! {git_url}")
|
||||||
|
continue
|
||||||
|
|
||||||
order = {
|
order = {
|
||||||
'git_url' : git_url,
|
'git_url' : git_url,
|
||||||
'email' : checkout['customer_details']['email'],
|
'email' : checkout['customer_details']['email'],
|
||||||
'time' : datetime.fromtimestamp(checkout['created']).replace(tzinfo=pytz.UTC),
|
'time' : datetime.fromtimestamp(checkout['created']).replace(tzinfo=pytz.UTC),
|
||||||
}
|
}
|
||||||
orders.append(order)
|
orders.append(order)
|
||||||
if checkout['payment_intent'] in refunded_orders:
|
|
||||||
logging.warning(f"found a refunded order! {git_url}")
|
|
||||||
|
|
||||||
# pagination
|
# pagination
|
||||||
start_id = checkout['id']
|
start_id = checkout['id']
|
||||||
|
|||||||
+4
-1
@@ -188,9 +188,12 @@ class Project():
|
|||||||
assert len(top_verilog) == 1
|
assert len(top_verilog) == 1
|
||||||
return top_verilog[0]
|
return top_verilog[0]
|
||||||
|
|
||||||
|
def get_git_remote(self):
|
||||||
|
return list(git.Repo(self.local_dir).remotes[0].urls)[0]
|
||||||
|
|
||||||
def clone(self):
|
def clone(self):
|
||||||
if os.path.exists(self.local_dir):
|
if os.path.exists(self.local_dir):
|
||||||
git_remote = list(git.Repo(self.local_dir).remotes[0].urls)[0]
|
git_remote = self.get_git_remote()
|
||||||
if self.git_url == git_remote:
|
if self.git_url == git_remote:
|
||||||
logging.info("git repo already exists and is correct - skipping")
|
logging.info("git repo already exists and is correct - skipping")
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user