penilaian.py
1.07 KB
from sqlalchemy import (Column, SmallInteger, Integer, DateTime, String, func, Float, and_)
from sqlalchemy.ext.hybrid import hybrid_property
from .tools import FixNop, FixSppt, FixBlok, FixKelurahan
from . import (
PbbBase, PbbDBSession, PBB_ARGS,
CommonModel, BaseNop, BaseBlok, BaseKelurahan,
Kelurahan, Kecamatan, Dati2
)
class Kalibrasi(PbbBase, BaseKelurahan):
__tablename__ = 'kalibrasi'
thn_kalibrasi = Column(String(4), primary_key=True)
indeks_kalibrasi = Column(SmallInteger, primary_key=True)
tgl_kalibrasi = Column(DateTime)
nip_pengkalibrasi = Column(String(18))
@hybrid_property
def id(self):
return "{}-{}.{}".format(super().id, self.thn_kalibrasi, self.indeks_kalibrasi)
@classmethod
def query_tahun(cls, kode_kel, tahun, db_session=PbbDBSession):
return cls.query_kel(kode_kel, db_session).filter(cls.thn_kalibrasi == tahun)
@classmethod
def query_id(cls, kode_kel, tahun, index, db_session=PbbDBSession):
return cls.query_tahun(kode_kel, tahun, db_session).filter(cls.indeks_kalibrasi == index)