update coefficients
This commit is contained in:
@@ -6,13 +6,13 @@ import os
|
|||||||
from google.cloud.firestore_v1.base_query import FieldFilter
|
from google.cloud.firestore_v1.base_query import FieldFilter
|
||||||
from datetime import datetime
|
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)
|
cred = credentials.Certificate(key_path)
|
||||||
firebase_admin.initialize_app(cred)
|
firebase_admin.initialize_app(cred)
|
||||||
def update_coefficent(source_collection):
|
def update_coefficent(source_collection):
|
||||||
db = firestore.client()
|
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:
|
for doc in docs:
|
||||||
doc_id = doc.id #doc.to_dict()["_id"]
|
doc_id = doc.id #doc.to_dict()["_id"]
|
||||||
@@ -20,7 +20,7 @@ def update_coefficent(source_collection):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
db.collection(source_collection).document(doc_id).update({
|
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")
|
"calibratedAt": datetime.today().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
})
|
})
|
||||||
print(f"Document with ID '{doc_id}' updated")
|
print(f"Document with ID '{doc_id}' updated")
|
||||||
|
|||||||
Reference in New Issue
Block a user