feat: sort projects by sort_id in commit_id.json

Sorting helps preventing projects shifting around as the shuttle fills up. "sort_id" is provided by the tt-app.
This commit is contained in:
Uri Shaked
2023-07-24 22:12:18 +03:00
parent 016ed6e8c1
commit ab9897699f
+3
View File
@@ -43,6 +43,7 @@ class Projects():
project = Project(index, commit_id_data['repo'], project_dir, args, is_user_project=False) project = Project(index, commit_id_data['repo'], project_dir, args, is_user_project=False)
project.commit_id = commit_id_data['commit'] project.commit_id = commit_id_data['commit']
project.sort_id = commit_id_data['sort_id']
# projects should now be installed, so load all the data from the yaml files # projects should now be installed, so load all the data from the yaml files
# fill projects will load from the fill project's directory # fill projects will load from the fill project's directory
@@ -60,6 +61,8 @@ class Projects():
self.projects.append(project) self.projects.append(project)
self.projects.sort(key=lambda x: x.sort_id)
all_macro_instances = [project.get_macro_instance() for project in self.projects] all_macro_instances = [project.get_macro_instance() for project in self.projects]
self.assert_unique(all_macro_instances) self.assert_unique(all_macro_instances)