Skip to content

Commit

Permalink
Update finished at for combined memory
Browse files Browse the repository at this point in the history
  • Loading branch information
beastoin committed Sep 22, 2024
1 parent 60b33c4 commit 35027e2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/database/memories.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,11 @@ def update_memory_events(uid: str, memory_id: str, events: List[dict]):
memory_ref = user_ref.collection('memories').document(memory_id)
memory_ref.update({'structured.events': events})

def update_memory_finished_at(uid: str, memory_id: str, finished_at: datetime):
user_ref = db.collection('users').document(uid)
memory_ref = user_ref.collection('memories').document(memory_id)
memory_ref.update({'finished_at': finished_at})


# VISBILITY

Expand Down
4 changes: 4 additions & 0 deletions backend/routers/transcribe.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ async def _create_memory():
memories_db.update_memory_segments(uid, memory.id,
[segment.dict() for segment in memory.transcript_segments])

# Update finished at
memory.finished_at = datetime.fromtimestamp(memory.started_at.timestamp() + processing_memory.transcript_segments[-1].end, timezone.utc)
memories_db.update_memory_finished_at(uid, memory.id, memory.finished_at)

# Process
memory = process_memory(uid, memory.language, memory, force_process=True)

Expand Down

0 comments on commit 35027e2

Please sign in to comment.