Skip to content

Commit

Permalink
check for db before sync
Browse files Browse the repository at this point in the history
  • Loading branch information
tomlue committed Apr 16, 2024
1 parent 494e938 commit bd45621
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='sysrev',
version='1.3.2',
version='1.3.4',
description='get sysrev project data and use the sysrev api',
long_description=long_description,
long_description_content_type='text/markdown', # Specify the content type here
Expand Down
7 changes: 6 additions & 1 deletion sysrev/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def transform_label(self, label_type, label_value):

class Synchronizer:

def create_sqlite_db():
def create_sqlite_db(self):
pathlib.Path(".sr").mkdir(exist_ok=True)
conn = sqlite3.connect('.sr/sr.sqlite')
c = conn.cursor()
Expand Down Expand Up @@ -93,7 +93,12 @@ def create_sqlite_db():
conn.commit()
conn.close()

# TODO - this could be made more efficient by checking sqlite state and updating the sysrev api
def sync(self, client, project_id):
# check that db exists
if not pathlib.Path('.sr/sr.sqlite').exists():
self.create_sqlite_db()

project_info = client.get_project_info(project_id)

labels = client.get_labels(project_id)
Expand Down

0 comments on commit bd45621

Please sign in to comment.