Index: /WAeUP_SRP/base/skins/waeup_utilities/test_getAccommodationInfo.py
===================================================================
--- /WAeUP_SRP/base/skins/waeup_utilities/test_getAccommodationInfo.py	(revision 3087)
+++ /WAeUP_SRP/base/skins/waeup_utilities/test_getAccommodationInfo.py	(revision 3087)
@@ -0,0 +1,66 @@
+## Script (Python) "test_getAccommodationInfo"
+##bind container=container
+##bind context=context
+##bind namespace=
+##bind script=script
+##bind subpath=traverse_subpath
+##parameters=
+##title=
+##
+# $Id$
+"""
+"""
+try:
+    from Products.zdb import set_trace
+except:
+    def set_trace():
+        pass
+
+mtool = context.portal_membership
+member = mtool.getAuthenticatedMember()
+if str(member) not in ('admin','joachim'):
+    return
+
+
+import logging
+import DateTime
+logger = logging.getLogger('Skins.test_getAccommodationInfo')
+from Products.AdvancedQuery import Eq, Between, Le,In
+aq_students = context.students_catalog.evalAdvancedQuery
+aq_portal = context.portal_catalog_real.evalAdvancedQuery
+students_folder = context.portal_url.getPortalObject().campus.students
+
+request = context.REQUEST
+session = request.SESSION
+response = request.RESPONSE
+setheader = request.RESPONSE.setHeader
+testcases = {}
+testcases['K817845'] = {'booking_allowed': False, 
+                        'student_status': 'female_re',}
+testcases['E561916'] = {'booking_allowed': False, 
+                        'student_status': 'female_fi',}
+ok_count = 0
+failed_count = 0
+logger.info("start test for %d students" % (len(testcases)))
+for student_id,expected in testcases.items():
+    logger.info("testing %s" % student_id)
+    info = context.getAccommodationInfo(student_id)
+    failed = False
+    for k in expected.keys():
+        if info[k] != expected[k]:
+            failed = True
+            break
+    if failed:
+        failed_count += 1
+        got = {}
+        for k in expected.keys():
+            got[k] = info[k]
+        logger.info("failed for %s expected %s got %s" % (student_id,
+                                                        expected,
+                                                        got
+                                                       ))
+    else:
+        logger.info("test %s OK" % student_id)
+        ok_count += 1
+
+logger.info("finished %d tests %d ok %d failed" % (len(testcases),ok_count,failed_count))
Index: /WAeUP_SRP/uniben/waeup_custom/getAccommodationInfo.py
===================================================================
--- /WAeUP_SRP/uniben/waeup_custom/getAccommodationInfo.py	(revision 3086)
+++ /WAeUP_SRP/uniben/waeup_custom/getAccommodationInfo.py	(revision 3087)
@@ -83,16 +83,23 @@
 booking_allowed = False
 
-new = student_record.entry_session == session[0]
-arrived = student_record.session == session[0]
+# new = student_record.entry_session == session[0]
+# arrived = student_record.session == session[0]
 
-if new and arrived and student_record.review_state in new_states:
-    booking_allowed = True
-elif arrived:
-    dummy,on_probation = divmod(int(student_record.level),100)
-    if not on_probation:
-        booking_allowed = True
+# if new and arrived and student_record.review_state in new_states:
+#     booking_allowed = True
+# elif arrived:
+#     dummy,on_probation = divmod(int(student_record.level),100)
+#     if not on_probation:
+#         booking_allowed = True
+# elif int(student_record.session) == int(session[0]) - 1:
+#     if student_record.verdict in ('A','B',):
+#         booking_allowed = True
+if student_record.session == session[0]:
+    if student_record.entry_session == session[0]:
+        booking_allowed = student_record.review_state in new_states
+    else:
+        booking_allowed = not (int(student_record.level) % 100)
 elif int(student_record.session) == int(session[0]) - 1:
-    if student_record.verdict in ('A','B',):
-        booking_allowed = True
+    booking_allowed = student_record.verdict in ('A','B',)
     
 info['booking_allowed'] = booking_allowed
@@ -147,9 +154,5 @@
 #elif student_record.course in pti_certificates:
 #    bt += "_pti"
-
-
 info['sex']=d['sex']
-
-
 d['bt'] = bt
 student_status = "%(sex)s_%(bt)s" % d
