Skip to content
Snippets Groups Projects

Functionally test write to db

Merged willm3 requested to merge wmalisch/dev2 into main
3 files
+ 11
2
Compare changes
  • Side-by-side
  • Inline
Files
3
+ 6
2
from scipy.signal import find_peaks
from sqlite_db_client import SQLiteDBClient
from src.sqlite_db_client import SQLiteDBClient
from pathlib import Path
import numpy as np
import time
@@ -15,8 +15,12 @@ class Activity:
try:
print("Activity started.")
self.running = True
magnitudes = []
start_date = time.strftime('%Y-%m-%d')
start_time = time.strftime('%H:%M:%S')
# Write accelerometer data to disk as a default in case we need to back it up later
timestamp = int(time.time())
output_file_path = Path(f"outputs/{timestamp}.csv").resolve()
@@ -64,7 +68,7 @@ class Activity:
end_date = time.strftime('%Y-%m-%d')
end_time = time.strftime('%H:%M:%S')
steps_count = len(steps)
self.db_client.update_activity_entry(timestamp, end_date, end_time, steps_count)
self.db_client.insert_activity_entry(start_date, start_time, end_date, end_time, steps_count)
return True
Loading