Skip to content

Commit

Permalink
TVB-2724 Small code review
Browse files Browse the repository at this point in the history
  • Loading branch information
liadomide committed Jun 19, 2020
1 parent 3277e22 commit 7458c01
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,7 @@ def stop_burst_operation(self, operation_id, is_group, remove_after_stop=False):
current_burst = common.get_from_session(common.KEY_BURST_CONFIG)
if current_burst and current_burst.id == operation.burst.id:
common.remove_from_session(common.KEY_BURST_CONFIG)
BurstService.remove_burst(operation.burst.id)
result = BurstService.remove_burst(operation.burst.id) or result

return result
except Exception as ex:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,18 +254,18 @@ def cancel_or_remove_burst(self, burst_id):
"""
burst_id = int(burst_id)
session_burst = common.get_from_session(common.KEY_BURST_CONFIG)

if session_burst.status == session_burst.BURST_RUNNING:
removed = OperationService().stop_operation(session_burst.fk_simulation)
else:
removed = BurstService().remove_burst(burst_id)
if removed:
if session_burst.id == burst_id:
return "reset-new"
return 'done'
else:
OperationService().stop_operation(session_burst.fk_simulation)
# Burst was stopped since it was running
return 'canceled'

BurstService().remove_burst(burst_id)
if session_burst.id == burst_id:
return "reset-new"
return 'done'


@expose_page
@settings
@context_selected
Expand Down
4 changes: 2 additions & 2 deletions framework_tvb/tvb/interfaces/web/static/js/genericTVB.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,9 +608,9 @@ function _stopOperationsOrBurst(operationId, isGroup, isBurst, removeAfter) {
url: urlBase,
success: function (r) {
if (r.toLowerCase() === 'true') {
displayMessage("The operation was successfully removed.", "infoMessage")
displayMessage("The operation was successfully stopped/removed.", "infoMessage")
} else {
displayMessage("Could not remove operation.", 'warningMessage');
displayMessage("Could not stop/remove operation.", 'warningMessage');
}
if (removeAfter) {
refreshOperations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def test_fire_operation(self):
Test preparation of an adapter and launch mechanism.
"""
adapter = TestFactory.create_adapter("tvb.tests.framework.adapters.testadapter1", "TestAdapter1")
test_user = TestFactory.create_user()
test_user = TestFactory.create_user(username="test_user_fire_sim")
test_project = TestFactory.create_project(admin=test_user)

result = OperationService().fire_operation(adapter, test_user, test_project.id,
Expand Down

0 comments on commit 7458c01

Please sign in to comment.