Skip to content

Commit

Permalink
Merge pull request #76 from ActivityWatch/dev/insert-event-no-return
Browse files Browse the repository at this point in the history
api: Make insert event never return anything
  • Loading branch information
johan-bjareholt committed Mar 18, 2021
2 parents 5950a82 + 61b362a commit f0d6500
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion aw_server/__about__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def detect_version():
return basever + ".dev+unknown"


__version__ = 'v0.10.dev+32e3624'
__version__ = "v0.10.dev+32e3624"


def assign_static_version():
Expand Down
2 changes: 1 addition & 1 deletion aw_server/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def create_events(self, bucket_id: str, events: List[Event]) -> Optional[Event]:
"""Create events for a bucket. Can handle both single events and multiple ones.
Returns the inserted event when a single event was inserted, otherwise None."""
return self.db[bucket_id].insert(events[0] if len(events) == 1 else events)
return self.db[bucket_id].insert(events)

@check_bucket_exists
def get_eventcount(
Expand Down
6 changes: 3 additions & 3 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,9 @@ def test_list_buckets(aw_client, bucket):

def test_send_event(aw_client, bucket):
event = Event(timestamp=datetime.now(tz=timezone.utc), data={"label": "test"})
recv_event = aw_client.send_event(bucket, event)
assert recv_event.id is not None
assert recv_event == event
aw_client.send_event(bucket, event)
recv_events = aw_client.get_events(bucket, limit=1)
assert recv_events == [event]


def test_send_events(aw_client, bucket):
Expand Down

0 comments on commit f0d6500

Please sign in to comment.