Skip to content

Commit

Permalink
maj
Browse files Browse the repository at this point in the history
  • Loading branch information
m4dm4rtig4n committed Oct 3, 2022
1 parent 316c217 commit 1ecc4e6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/models/cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from dependencies import *
from config import *
from models.log import log, logSep, logWarn, critical
from models.log import log, logSep, logWarn, critical, debug
from models.config import CONFIG, get_version


Expand Down Expand Up @@ -111,11 +111,13 @@ def purge_cache(self):

def get_contract(self, usage_point_id):
query = f"SELECT * FROM contracts WHERE pdl = '{usage_point_id}'"
debug(query)
self.cursor.execute(query)
query_result = self.cursor.fetchone()
return query_result

def insert_contract(self, usage_point_id, contract, count):
query = f"INSERT OR REPLACE INTO contracts VALUES (?,?,?)'"
query = f"INSERT OR REPLACE INTO contracts VALUES (?,?,?)"
debug(query)
self.cursor.execute(query, [usage_point_id, json.dumps(contract), count])
self.sqlite.commit()
return self.sqlite.commit()
1 change: 1 addition & 0 deletions app/models/myelectricaldata.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import sys

from models.config import get_version
from models.query import Query
Expand Down

0 comments on commit 1ecc4e6

Please sign in to comment.