correction erreur dans les anniversary_cotisation + affichage du code couleur sur les chambres
This commit is contained in:
parent
7f683c64e0
commit
fe3631a894
@ -50,8 +50,17 @@ class RoomsController(AuthenticatedBaseController):
|
|||||||
raise Exception("unknown residence")
|
raise Exception("unknown residence")
|
||||||
#end if
|
#end if
|
||||||
stats = CotisationComputes.members_status_from_residence(self.user, residence_dn)
|
stats = CotisationComputes.members_status_from_residence(self.user, residence_dn)
|
||||||
|
|
||||||
|
members = dict()
|
||||||
|
for label in stats:
|
||||||
|
for member in stats[label]:
|
||||||
|
members[member.dn] = label
|
||||||
|
#end for member
|
||||||
|
#end for stats
|
||||||
|
|
||||||
stats['number_of_rooms'] = Room.get_number_of_rooms(self.user, residence_dn)
|
stats['number_of_rooms'] = Room.get_number_of_rooms(self.user, residence_dn)
|
||||||
stats['empty_rooms'] = []
|
stats['empty_rooms'] = []
|
||||||
|
|
||||||
for area in Room.get_areas(self.user, residence_dn):
|
for area in Room.get_areas(self.user, residence_dn):
|
||||||
areas[area] = dict()
|
areas[area] = dict()
|
||||||
|
|
||||||
@ -59,9 +68,15 @@ class RoomsController(AuthenticatedBaseController):
|
|||||||
areas[area][floor] = list()
|
areas[area][floor] = list()
|
||||||
|
|
||||||
for room in Room.get_rooms_of_floor(self.user, floor.dn):
|
for room in Room.get_rooms_of_floor(self.user, floor.dn):
|
||||||
areas[area][floor].append(room)
|
|
||||||
if not room.has("x-memberIn"):
|
if not room.has("x-memberIn"):
|
||||||
stats['empty_rooms'].append(room)
|
stats['empty_rooms'].append(room)
|
||||||
|
room.add('status', "empty_room")
|
||||||
|
elif room.get("x-memberIn").first() in members:
|
||||||
|
room.add('status', members[room.get("x-memberIn").first()])
|
||||||
|
#endif
|
||||||
|
|
||||||
|
areas[area][floor].append(room)
|
||||||
|
|
||||||
|
|
||||||
color = self.color_picker("foobar")
|
color = self.color_picker("foobar")
|
||||||
if color in status:
|
if color in status:
|
||||||
|
@ -99,11 +99,11 @@ class CotisationComputes:
|
|||||||
@staticmethod
|
@staticmethod
|
||||||
def anniversary_from_ldap_items(ldap_cotisations):
|
def anniversary_from_ldap_items(ldap_cotisations):
|
||||||
result = []
|
result = []
|
||||||
|
months = []
|
||||||
for cotisation in ldap_cotisations:
|
for cotisation in ldap_cotisations:
|
||||||
anniversary_data = cotisation.get("x-time").first()
|
anniversary_data = cotisation.get("x-time").first()
|
||||||
anniversary_datetime = datetime.datetime.strptime(anniversary_data,
|
anniversary_datetime = datetime.datetime.strptime(anniversary_data,
|
||||||
"%Y-%m-%d %H:%M:%S.%f")
|
"%Y-%m-%d %H:%M:%S.%f")
|
||||||
months = []
|
|
||||||
for month in cotisation.get("x-validMonth").all():
|
for month in cotisation.get("x-validMonth").all():
|
||||||
months.append(int(month))
|
months.append(int(month))
|
||||||
#end for
|
#end for
|
||||||
@ -116,7 +116,6 @@ class CotisationComputes:
|
|||||||
|
|
||||||
if result != []:
|
if result != []:
|
||||||
anniversary_day = result[0][0].day
|
anniversary_day = result[0][0].day
|
||||||
months = result[0][1]
|
|
||||||
SORT_ORDER = {9: 0, 10: 1, 11: 2, 12: 3, 1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9, 7: 10, 8: 11}
|
SORT_ORDER = {9: 0, 10: 1, 11: 2, 12: 3, 1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9, 7: 10, 8: 11}
|
||||||
months.sort(key=lambda val: SORT_ORDER[val])
|
months.sort(key=lambda val: SORT_ORDER[val])
|
||||||
anniversary_month = months[-1] + 1
|
anniversary_month = months[-1] + 1
|
||||||
|
@ -21,10 +21,16 @@
|
|||||||
<div>
|
<div>
|
||||||
<div class="room_number non_certif_color">${"%03d" % len(stats['cotisation_late_members'])}</div>
|
<div class="room_number non_certif_color">${"%03d" % len(stats['cotisation_late_members'])}</div>
|
||||||
<span>Cotisations en retard</span>
|
<span>Cotisations en retard</span>
|
||||||
|
<div py:for="member in stats['cotisation_late_members']">
|
||||||
|
<span><a href="/show/member/${residence}/${member.uid.first()}">${member.cn.first()}</a></span><br />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="room_number non_paye_color">${"%03d" % len(stats['no_cotisation_members'])}</div>
|
<div class="room_number non_paye_color">${"%03d" % len(stats['no_cotisation_members'])}</div>
|
||||||
<span>Sans cotisations</span>
|
<span>Sans cotisations</span>
|
||||||
|
<div py:for="member in stats['no_cotisation_members']">
|
||||||
|
<span><a href="/show/member/${residence}/${member.uid.first()}">${member.cn.first()}</a></span><br />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="room_number vide_color">${"%03d" % len(stats['old_members'])}</div>
|
<div class="room_number vide_color">${"%03d" % len(stats['old_members'])}</div>
|
||||||
@ -59,9 +65,30 @@
|
|||||||
<span class="section_name">${(area.cn.first()).upper()}</span>
|
<span class="section_name">${(area.cn.first()).upper()}</span>
|
||||||
<div py:for="floor, rooms in reverse_sorted_name(floors.iteritems())" class="floor">
|
<div py:for="floor, rooms in reverse_sorted_name(floors.iteritems())" class="floor">
|
||||||
<span class="floor_name">étage ${floor.cn.first()}</span>
|
<span class="floor_name">étage ${floor.cn.first()}</span>
|
||||||
<div py:for="room in sorted(rooms, key=lambda t:t.cn.first())" class="room_number">
|
<py:for each="room in sorted(rooms, key=lambda t:t.cn.first())" class="room_number">
|
||||||
<a href="/rooms/preview/${residence}/${room.uid.first()}"><span>${room.cn.first()}</span></a>
|
<py:choose test="room.status.first()">
|
||||||
</div>
|
<py:when test="'cotisation_paid_members'">
|
||||||
|
<div class="room_number ok_color">
|
||||||
|
<a href="/rooms/preview/${residence}/${room.uid.first()}"><span>${room.cn.first()}</span></a>
|
||||||
|
</div>
|
||||||
|
</py:when>
|
||||||
|
<py:when test="'cotisation_late_members'">
|
||||||
|
<div class="room_number non_certif_color">
|
||||||
|
<a href="/rooms/preview/${residence}/${room.uid.first()}"><span>${room.cn.first()}</span></a>
|
||||||
|
</div>
|
||||||
|
</py:when>
|
||||||
|
<py:when test="'no_cotisation_members'">
|
||||||
|
<div class="room_number non_paye_color">
|
||||||
|
<a href="/rooms/preview/${residence}/${room.uid.first()}"><span>${room.cn.first()}</span></a>
|
||||||
|
</div>
|
||||||
|
</py:when>
|
||||||
|
<py:otherwise>
|
||||||
|
<div class="room_number vide_color">
|
||||||
|
<a href="/rooms/preview/${residence}/${room.uid.first()}"><span>${room.cn.first()}</span></a>
|
||||||
|
</div>
|
||||||
|
</py:otherwise>
|
||||||
|
</py:choose>
|
||||||
|
</py:for>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user