update coefficients
This commit is contained in:
@@ -6,13 +6,13 @@ import os
|
||||
from google.cloud.firestore_v1.base_query import FieldFilter
|
||||
from datetime import datetime
|
||||
|
||||
key_path = os.getcwd() + '/keys/hpos-prod-firebase-adminsdk.json'
|
||||
key_path = os.getcwd() + '/keys/hpos-qa-firebase-adminsdk.json'
|
||||
cred = credentials.Certificate(key_path)
|
||||
firebase_admin.initialize_app(cred)
|
||||
def update_coefficent(source_collection):
|
||||
db = firestore.client()
|
||||
|
||||
docs = db.collection(source_collection).where(filter = FieldFilter("deviceId", "==", "HC-V1-014")).stream()
|
||||
docs = db.collection(source_collection).where(filter = FieldFilter("deviceId", "==", "HCV-000-3001")).stream()
|
||||
|
||||
for doc in docs:
|
||||
doc_id = doc.id #doc.to_dict()["_id"]
|
||||
@@ -20,7 +20,7 @@ def update_coefficent(source_collection):
|
||||
|
||||
try:
|
||||
db.collection(source_collection).document(doc_id).update({
|
||||
"coefficients": [0.5136, 0.0242],
|
||||
"coefficients": [1, 0],
|
||||
"calibratedAt": datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||
})
|
||||
print(f"Document with ID '{doc_id}' updated")
|
||||
|
||||
Reference in New Issue
Block a user