lint and partially working

This commit is contained in:
matt venn
2023-03-13 18:05:56 +01:00
parent 28a4340240
commit 97cfa3b15e
7 changed files with 36 additions and 67 deletions
+6 -9
View File
@@ -1,8 +1,8 @@
import stripe, os, json
import stripe, os
from datetime import datetime
from collections import OrderedDict
import yaml
class Orders():
def __init__(self, config):
@@ -11,7 +11,6 @@ class Orders():
stripe.api_key = os.environ['STRIPE_TOKEN']
self.orders = []
def fetch_orders(self):
start_id = None
after_open_date = True
@@ -35,29 +34,27 @@ class Orders():
# pagination
start_id = checkout['id']
# put in date order
self.orders.reverse()
return self.orders
def update_project_list(self):
project_list = {}
# first project is the filler test project
index = 0
project = { 'url': self.config['filler_project'], 'status': 'active', 'fill': False }
project = {'url': self.config['filler_project'], 'status': 'active', 'fill': False}
project_list[index] = project
# add all the real orders
for index, order in enumerate(self.orders):
project = { 'url': order['git_url'], 'status': 'active', 'fill': False }
project = {'url': order['git_url'], 'status': 'active', 'fill': False}
project_list[index + 1] = project
# fill with the filler
for index in range(len(project_list), self.config['num_projects']):
project = { 'url': self.config['filler_project'], 'status': 'active', 'fill': True }
project = {'url': self.config['filler_project'], 'status': 'active', 'fill': True}
project_list[index] = project
with open('projects.yaml', 'w') as fh:
fh.write(yaml.dump(project_list, sort_keys=False))