Publish 0.002 with a setup lookup, a name-only car, and the deeper car setup.
This commit is contained in:
1 parent
ffad275e13
commit
ecd5c286dd
15 files changed
+478
-165
No files matched your search
+48
-2
@@ -27,6 +27,8 @@ SHEET_FIELDS = [
|
||||
"recordedAt", "note", "crossPercent", "springLf", "springRf", "springLr", "springRr",
|
||||
"camberLf", "camberRf", "casterLf", "casterRf", "swayBarHole", "blockLr", "blockRr",
|
||||
"toeFront", "toeRear",
|
||||
"weightLf", "weightRf", "weightLr", "weightRr",
|
||||
"rideHeight", "pinion", "brakeFront",
|
||||
]
|
||||
|
||||
_lock = threading.Lock()
|
||||
@@ -89,10 +91,30 @@ def open_db(path):
|
||||
db.row_factory = sqlite3.Row
|
||||
db.execute("PRAGMA journal_mode=WAL")
|
||||
db.executescript(SCHEMA)
|
||||
ensure_columns(
|
||||
db,
|
||||
"sheets",
|
||||
{
|
||||
"weightLf": "INTEGER",
|
||||
"weightRf": "INTEGER",
|
||||
"weightLr": "INTEGER",
|
||||
"weightRr": "INTEGER",
|
||||
"rideHeight": "REAL",
|
||||
"pinion": "REAL",
|
||||
"brakeFront": "REAL",
|
||||
},
|
||||
)
|
||||
db.commit()
|
||||
return db
|
||||
|
||||
|
||||
def ensure_columns(db, table, columns):
|
||||
present = {row["name"] for row in db.execute(f"PRAGMA table_info({table})")}
|
||||
for name, kind in columns.items():
|
||||
if name not in present:
|
||||
db.execute(f"ALTER TABLE {table} ADD COLUMN {name} {kind}")
|
||||
|
||||
|
||||
def space(bearer):
|
||||
path = space_path(bearer)
|
||||
with _lock:
|
||||
@@ -182,7 +204,14 @@ SCHEMA = """
|
||||
blockLr REAL,
|
||||
blockRr REAL,
|
||||
toeFront REAL,
|
||||
toeRear REAL
|
||||
toeRear REAL,
|
||||
weightLf INTEGER,
|
||||
weightRf INTEGER,
|
||||
weightLr INTEGER,
|
||||
weightRr INTEGER,
|
||||
rideHeight REAL,
|
||||
pinion REAL,
|
||||
brakeFront REAL
|
||||
);
|
||||
"""
|
||||
|
||||
@@ -503,7 +532,22 @@ def selftest():
|
||||
"recordedAt": 11,
|
||||
}
|
||||
],
|
||||
"sheets": [],
|
||||
"sheets": [
|
||||
{
|
||||
"syncId": "sheet-a",
|
||||
"updatedAt": 12,
|
||||
"deleted": False,
|
||||
"recordedAt": 12,
|
||||
"note": "",
|
||||
"weightLf": 800,
|
||||
"weightRf": 760,
|
||||
"weightLr": 740,
|
||||
"weightRr": 700,
|
||||
"rideHeight": 5.0,
|
||||
"pinion": -2.0,
|
||||
"brakeFront": 62.0,
|
||||
}
|
||||
],
|
||||
}
|
||||
)
|
||||
second = sync_body({"rev": 0, "profile": {"carName": "1976 Chevy Camaro", "raceClass": "Hobby Stock", "discipline": "Oval", "updatedAt": 0}, "nights": [], "runs": [], "sheets": []})
|
||||
@@ -511,6 +555,8 @@ def selftest():
|
||||
raise SystemExit("second phone did not receive the night")
|
||||
if second["runs"][0]["nightSyncId"] != "night-a":
|
||||
raise SystemExit("second phone did not receive the run")
|
||||
if second["sheets"][0]["weightLf"] != 800 or second["sheets"][0]["pinion"] != -2.0:
|
||||
raise SystemExit("second phone did not receive the setup")
|
||||
older = sync_body(
|
||||
{
|
||||
"rev": first["rev"],
|
||||
|
||||
Reference in new issue
Block a user