Repository: qiskit-community/ecosystem (python)

Issue:
test types in dev/stable/standard order
The test results have a kinda arbitrary order sometimes. It should be 
```
dev
stable
standard
```

Pull request:
Issue 146 | Members: add order of test results
<!--
⚠️ If you do not respect this template, your pull request will be closed.
⚠️ Your pull request title should be short detailed and understandable for all.
⚠️ Also, please add a release note file using reno if the change needs to be
  documented in the release notes.
⚠️ If your pull request fixes an open issue, please link to the issue.

- [ ] I have added the tests to cover my changes.
- [ ] I have updated the documentation accordingly.
- [ ] I have read the CONTRIBUTING document.
-->

### Summary

Members: add order of test results

### Details and comments

Closes #146

Patch:
diff --git a/ecosystem/daos/jsondao.py b/ecosystem/daos/jsondao.py
index 5087412..009e80a 100644
--- a/ecosystem/daos/jsondao.py
+++ b/ecosystem/daos/jsondao.py
@@ -111,7 +111,7 @@ class JsonDAO:
             new_test_results = [
                 tr for tr in repo.tests_results if tr.test_type != test_result.test_type
             ] + [test_result]
-            repo.tests_results = new_test_results
+            repo.tests_results = sorted(new_test_results, key=lambda r: r.test_type)
 
             new_historical_est_results = [
                 tr


Test patch:
diff --git a/tests/daos/test_dao.py b/tests/daos/test_dao.py
index e2ca786..079dc26 100644
--- a/tests/daos/test_dao.py
+++ b/tests/daos/test_dao.py
@@ -145,3 +145,32 @@ class TestJsonDao(TestCase):
                 TestResult(True, "0.18.2", TestType.STANDARD),
             ],
         )
+
+    def test_add_test_result_order(self):
+        """Test order of test results."""
+        self._delete_members_json()
+        dao = JsonDAO(self.path)
+
+        main_repo = get_main_repo()
+        dao.insert(main_repo)
+        dao.add_repo_test_result(
+            main_repo.url,
+            main_repo.tier,
+            TestResult(False, "0.18.1", TestType.STABLE_COMPATIBLE),
+        )
+        dao.add_repo_test_result(
+            main_repo.url,
+            main_repo.tier,
+            TestResult(False, "0.18.1", TestType.STANDARD),
+        )
+        dao.add_repo_test_result(
+            main_repo.url,
+            main_repo.tier,
+            TestResult(False, "0.18.1", TestType.DEV_COMPATIBLE),
+        )
+
+        recovered_repo = dao.get_by_url(main_repo.url, tier=main_repo.tier)
+        test_results = recovered_repo.tests_results
+        self.assertEqual(test_results[0].test_type, TestType.DEV_COMPATIBLE)
+        self.assertEqual(test_results[1].test_type, TestType.STABLE_COMPATIBLE)
+        self.assertEqual(test_results[2].test_type, TestType.STANDARD)