Skip to content
This repository has been archived by the owner on Jun 21, 2019. It is now read-only.

Commit

Permalink
Sinav programi yayinlama arama duzeltildi.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcTlg committed Jul 29, 2016
1 parent 88261ef commit 9efb301
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions ulakbus/views/ders_programi/sinav_programi.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
from collections import OrderedDict

from ulakbus.models import SinavEtkinligi, Donem, Okutman, Room
from ulakbus.models import SinavEtkinligi, Donem, Okutman, Room, Sube
from ulakbus.services.zato_wrapper import SinavProgramiOlustur
from ulakbus.views.ders_programi.ders_programi import AramaForm
from zengine.forms import JsonForm
Expand Down Expand Up @@ -176,11 +176,12 @@ def detay_goster(self):
else:
obj_key = self.current.task_data['data_key']
if self.input['form']['arama_sec'] == 1:
ders_etkinligi = SinavEtkinligi.objects.filter(room_id=obj_key)
ders_etkinligi = SinavEtkinligi.objects.raw("sinav_yerleri.room_id:" + obj_key)
obj = Room.objects.get(obj_key)

else:
ders_etkinligi = SinavEtkinligi.objects.filter(okutman_id=obj_key)
ders_etkinligi = map(lambda s: SinavEtkinligi.objects.get(sube=s), Sube.objects.filter(
okutman_id=obj_key, donem=Donem.guncel_donem()))
obj = Okutman.objects.get(obj_key)

days = ["Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi", "Pazar"]
Expand All @@ -194,16 +195,14 @@ def etkinlik(de):
:param de: ders etkinligi
:return: ders adi ve zamani
"""
aralik = "%s:%s - %s:%s" % (de.baslangic_saat,
de.baslangic_dakika,
de.bitis_saat,
de.bitis_dakika)
aralik = de.tarih.strftime('%H.%M, %d.%m.%Y')
return "\n\n**%s**\n%s\n\n" % (aralik, de.ders.ad)

data_list = []
for day in days:
for i, day in enumerate(days):
data_list.append(
''.join(["%s" % etkinlik(de) for de in ders_etkinligi.filter(gun=days.index(day) + 1)]))
''.join(["%s" % etkinlik(de) for de in filter(lambda d: d.tarih.isoweekday() == i + 1,
ders_etkinligi)]))

item = {
"title": "%s - Detaylı Zaman Tablosu" % obj.__unicode__(),
Expand Down

0 comments on commit 9efb301

Please sign in to comment.