Skip to content

Commit

Permalink
Fix case history is added twice
Browse files Browse the repository at this point in the history
Ref #285
  • Loading branch information
algorys committed Mar 25, 2018
1 parent a3eab74 commit a388393
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions alignak_app/backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -538,15 +538,18 @@ def query_history(self, hostname=None, host_id=None):
)

if request:
host_history = History()
logger.debug('Add / Update history for %s (%s)', hostname, host_id)
if data_manager.get_item('history', host_id):
data_manager.update_item_data('history', host_id, request['_items'])
else:
host_history = History()

host_history.create(
host_id,
request['_items'],
hostname,
)
logger.debug('Add history for %s (%s)', hostname, host_id)
data_manager.database['history'].append(host_history)
host_history.create(
host_id,
request['_items'],
hostname,
)
data_manager.database['history'].append(host_history)
else: # pragma: no cover, too long to test
history_list = []
for history in data_manager.database['history']:
Expand Down

0 comments on commit a388393

Please sign in to comment.