Skip to content

Commit

Permalink
remove commented code
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkent committed Aug 23, 2023
1 parent f720eab commit f8f677c
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 116 deletions.
1 change: 0 additions & 1 deletion store/neurostore/resources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,6 @@ def delete(self, id):
abort(403)
else:
db.session.delete(record)
self.post_delete(record)
db.session.commit()

# clear relevant caches
Expand Down
115 changes: 0 additions & 115 deletions store/neurostore/resources/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,23 +367,6 @@ def pre_nested_record_update(record):

return record

# def post_delete(record):
# base_study = getattr(record, "base_study", None)
# if base_study:
# base_study.has_images = any(
# a.images
# for study in base_study.versions
# if study is not record
# for a in study.analyses
# )
# base_study.has_coordinates = any(
# a.points
# for study in base_study.versions
# if study is not record
# for a in study.analyses
# )
# db.session.add(base_study)


@view_maker
class AnalysesView(ObjectView, ListView):
Expand All @@ -402,35 +385,6 @@ class AnalysesView(ObjectView, ListView):
}
_search_fields = ("name", "description")

# def post_nested_record_update(record):
# # need to do this custom update after the nested attributes are set
# if record.study.base_study
# return record

# def post_delete(record):
# study = getattr(record, "study", None)
# if not study:
# return

# if len(study.analyses) > 1:
# return

# base_study = getattr(study, "base_study", None)
# if base_study:
# base_study.has_images = any(
# a.images
# for study in base_study.versions
# for a in study.analyses
# if a is not record
# )
# base_study.has_coordinates = any(
# a.points
# for study in base_study.versions
# for a in study.analyses
# if a is not record
# )
# db.session.add(base_study)


@view_maker
class ConditionsView(ObjectView, ListView):
Expand All @@ -444,36 +398,6 @@ class ImagesView(ObjectView, ListView):
}
_search_fields = ("filename", "space", "value_type", "analysis_name")

# def post_nested_record_update(record):
# base_study = getattr(getattr(record, "study", None), "base_study", None)
# if base_study is not None and base_study.has_images is False:
# base_study.has_images = True
# db.session.add(base_study)
# return record

# def post_delete(record):
# analysis = getattr(record, "analysis", None)
# if not analysis:
# return

# study = getattr(analysis, "study", None)
# if not study:
# return

# if len(study.analyses) > 1:
# return

# if set(analysis.images) == set([record]):
# base_study = getattr(study, "base_study", None)
# if base_study:
# base_study.has_images = any(
# a.images
# for study in base_study.versions
# for a in study.analyses
# if a is not analysis
# )
# db.session.add(base_study)


@view_maker
class PointsView(ObjectView, ListView):
Expand All @@ -486,45 +410,6 @@ class PointsView(ObjectView, ListView):
}
_search_fields = ("space", "analysis_name")

# def post_nested_record_update(record):
# base_study = getattr(
# getattr(getattr(record, "analysis", None), "study", None),
# "base_study",
# None,
# )
# if base_study is not None and base_study.has_coordinates is False:
# base_study.has_coordinates = True
# db.session.add(base_study)
# return record

# def post_delete(record):
# analysis = getattr(record, "analysis", None)
# # nothing to update if point not connected to analysis
# if not analysis:
# return

# study = getattr(analysis, "study", None)
# # nothing to update if analysis is not connected to study
# if not study:
# return

# # nothing to update if there is more than 1 analysis
# if len(study.analyses) > 1:
# return

# # only care if the point is the last point in the analysis
# if set(analysis.points) == set([record]):
# base_study = getattr(study, "base_study", None)
# if base_study:
# base_study.has_coordinates = any(
# a.points
# for study in base_study.versions
# for a in study.analyses
# if a is not analysis
# )

# db.session.add(base_study)


@view_maker
class PointValuesView(ObjectView, ListView):
Expand Down

0 comments on commit f8f677c

Please sign in to comment.