Adjust resubmitted state in get_hda_dict rather than in multiple places further down.

This commit is contained in:
Nate Coraor
2014-08-18 15:25:29 -04:00
parent 5644f7396e
commit a48c6410dc
2 changed files with 7 additions and 7 deletions
+6
View File
@@ -800,6 +800,12 @@ class UsesHistoryDatasetAssociationMixin:
history_id = trans.security.encode_id( hda.history.id ),
history_content_id = trans.security.encode_id( hda.id ) )
# resubmitted is not a real state
hda_dict[ 'resubmitted' ] = False
if hda.state == trans.app.model.Dataset.states.RESUBMITTED:
hda_dict[ 'state' ] = hda.dataset.state
hda_dict[ 'resubmitted' ] = True
# indeces, assoc. metadata files, etc.
meta_files = []
for meta_type in hda.metadata.spec.keys():
@@ -132,15 +132,12 @@ class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociatio
api_type = "file"
encoded_id = trans.security.encode_id( hda.id )
# TODO: handle failed_metadata here as well
state = hda.state
if state == trans.app.model.Dataset.states.RESUBMITTED:
state = hda.dataset.state
return {
'id' : encoded_id,
'history_id' : encoded_history_id,
'name' : hda.name,
'type' : api_type,
'state' : state,
'state' : hda.dataset.state,
'deleted': hda.deleted,
'visible': hda.visible,
'purged': hda.purged,
@@ -162,9 +159,6 @@ class HistoryContentsController( BaseAPIController, UsesHistoryDatasetAssociatio
hda_dict = self.get_hda_dict( trans, hda )
hda_dict[ 'display_types' ] = self.get_old_display_applications( trans, hda )
hda_dict[ 'display_apps' ] = self.get_display_apps( trans, hda )
if hda_dict[ 'state' ] == trans.app.model.Dataset.states.RESUBMITTED:
hda_dict[ 'state' ] = hda.dataset.state
hda_dict[ 'resubmitted' ] = True
return hda_dict
except Exception, exc:
# catch error here - returning a briefer hda_dict with an error attribute