Skip to content

Commit

Permalink
refactor: return steps sorted by index
Browse files Browse the repository at this point in the history
  • Loading branch information
mutantsan committed Sep 12, 2023
1 parent ed06efa commit 62814ee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ckanext/tour/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ def dictize(self, context):

@property
def steps(self) -> list[TourStep]:
return [request_study for request_study in TourStep.get_by_tour(self.id)]
return sorted(
[request_study for request_study in TourStep.get_by_tour(self.id)],
key=lambda step: step.index,
)

@classmethod
def get(cls, tour_id: str) -> Self | None:
Expand Down

0 comments on commit 62814ee

Please sign in to comment.