Skip to content

Commit

Permalink
adding get_session function and removed the previous __main__ testing…
Browse files Browse the repository at this point in the history
… code!
  • Loading branch information
Jonak-Adipta-Kalita committed Jul 5, 2024
1 parent 911e88f commit aa2caf9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -220,5 +220,6 @@ $RECYCLE.BIN/
*.lnk

*.db
flomo/data/*

# End of https://www.toptal.com/developers/gitignore/api/windows,python,visualstudiocode
18 changes: 3 additions & 15 deletions flomo/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,6 @@ def get_sessions(self):
self.cursor.execute("SELECT * FROM sessions")
return self.cursor.fetchall()


if __name__ == "__main__":
tracker = Tracker()
tracker.create_table()

session_id = tracker.create_session("study", "work", datetime.datetime.now())

import time

time.sleep(5)

tracker.end_session(session_id, datetime.datetime.now())

print(tracker.get_sessions())
tracker.conn.close()
def get_session(self, session_id: float):
self.cursor.execute("SELECT * FROM sessions WHERE id = ?", (session_id,))
return self.cursor.fetchone()

0 comments on commit aa2caf9

Please sign in to comment.