Index: dbLearnStar-webApp/src/main/java/dblearnstar/webapp/services/TestManagerImpl.java
===================================================================
--- dbLearnStar-webApp/src/main/java/dblearnstar/webapp/services/TestManagerImpl.java	(revision cfd2bb41b298e8a69686cdcf02f98708df2659d6)
+++ dbLearnStar-webApp/src/main/java/dblearnstar/webapp/services/TestManagerImpl.java	(revision b512ab56be8f9eb7112c921ae83e55c757023bea)
@@ -100,8 +100,9 @@
 			long testCollectionId) {
 		String query = """
+				select ti
 				from TestInstance ti
-				join t.testTemplate ttem
+				join ti.testTemplate ttem
 				join ttem.testType tt
-				join t.testCollection tc
+				join ti.testCollection tc
 				where
 					tt.testTypeId = :testTypeId and
@@ -119,8 +120,9 @@
 							where
 								s.studentId=:studentId and
-								now() between ti2.scheduledFor and ti2.scheduledUntil
+								(now() between ti2.scheduledFor and ti2.scheduledUntil or 
+								ti2.openForReviewByStudents=true)
 						)
 					)
-				order by t.title desc
+				order by ti.ordering asc, ti.title desc
 				""";
 		return UsefulMethods.castList(TestInstance.class,
@@ -498,4 +500,5 @@
 	@Override
 	public boolean accessToTaskInTestInstanceAllowed(Student student, TaskInTestInstance tti) {
+		//TODO: need a more appropriate implementation
 		return getTestInstancesForStudentByTestType(student.getStudentId(),
 				tti.getTestInstance().getTestTemplate().getTestType().getTestTypeId()).stream()
@@ -521,5 +524,6 @@
 					from TestInstance ti
 					""").getResultList());
-			// Add to them TestCollectionts that are Parents to another, or that have subCollections
+			// Add to them TestCollectionts that are Parents to another, or that have
+			// subCollections
 			List<TestCollection> listAdded = UsefulMethods.castList(TestCollection.class,
 					getEntityManager().createQuery("""
