def get_budget_likelihoods_by_year(year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) is_lokpri = request.args.get('is_lokpri', default=True, type=bool) entities = budget_likelihood_repository.all_by_year( year, is_lokpri, page_sort_params) result = BudgetLikelihoodModelSchema(many=True).dump(entities) return jsonify(result.data)
def get_progress_timelines_by_year(year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) is_lokpri = request.args.get('is_lokpri', default=True, type=bool) entities = progress_timeline_repository.all_by_year( year, is_lokpri, page_sort_params) result = ProgressTimelineModelSchema(many=True).dump(entities) return jsonify(result.data)
def get_siskeudes_kegiatans_by_year(year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) is_lokpri = request.args.get('is_lokpri', default=True, type=bool) entities = siskeudes_kegiatan_repository.all_by_year( year, is_lokpri, page_sort_params) result = SiskeudesKegiatanModelSchema(many=True).dump(entities) return jsonify(result.data)
def get_by_region_and_year(self, region_id, year, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query \ .filter(self.model.fk_region_id == region_id) \ .filter(self.model.year == year) \ .all()
def all(self, is_lokpri=True, is_siskeudes_code=False, page_sort_params=None): query = self.db.session.query(self.model) if (is_lokpri): query = query.filter(self.model.is_lokpri == True) if (is_siskeudes_code): query = query.filter(self.model.siskeudes_code.isnot(None)) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.all()
def all_by_year(self, year, is_lokpri=True, page_sort_params=None): query = self.db.session.query(self.model) if is_lokpri: region = aliased(Region) query = query.outerjoin(region, self.model.region) query = query.filter(region.is_lokpri == True) query = query.filter(self.model.year == year) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.all()
def get_progress_recapitulations_by_year(year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) is_lokpri = request.args.get('is_lokpri', default=True, type=bool) region_id = request.args.get('region_id', default=None, type=str) entities = None if region_id is None: entities = progress_recapitulation_repository.all_by_year( year, is_lokpri, page_sort_params) else: entities = progress_recapitulation_repository.get_by_region_and_year( region_id, year, page_sort_params) result = ProgressRecapitulationModelSchema(many=True).dump(entities) return jsonify(result.data)
def all_by_condition(self, has_kode=False, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) if has_kode: query = query.filter(self.model.kode is not None).filter(func.length(self.model.kode > 0)) return query.all()
def get_by_region(self, region_id, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.filter(self.model.fk_region_id == region_id).all()
def all_by_year(self, year, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.filter(self.model.year == year).all()
def all(self, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.all()
def get_siskeudes_spps_buktis_by_region_and_year(region_id, year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) entities = siskeudes_spp_bukti_repository.get_by_region_and_year(region_id, year, page_sort_params) result = SiskeudesSppBuktiModelSchemaIso(many=True).dump(entities) return jsonify(result.data)
def get_budget_types(): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) is_revenue = request.args.get('is_revenue', default=False, type=bool) entities = budget_type_repository.all_by_condition(is_revenue=is_revenue, page_sort_params=page_sort_params) result = BudgetTypeModelSchema(many=True).dump(entities) return jsonify(result.data)
def all_by_condition(self, is_revenue=False, page_sort_params=None): query = self.db.session.query(self.model) query = QueryHelper.build_page_sort_query(query, self.model, page_sort_params) return query.filter(self.model.is_revenue == is_revenue).all()
def get_progress_timelines_by_region_and_year(region_id, year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) entities = progress_timeline_repository.get_by_region_and_year( region_id, year, page_sort_params) result = ProgressTimelineModelSchema(many=True).dump(entities) return jsonify(result.data)
def get_siskeudes_kegiatans_by_region_and_year(region_id, year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) entities = siskeudes_kegiatan_repository.get_by_region_and_year( region_id, year, page_sort_params) result = SiskeudesKegiatanModelSchema(many=True).dump(entities) return jsonify(result.data)
def get_budget_likelihoods_by_region_and_year(region_id, year): page_sort_params = QueryHelper.get_page_sort_params_from_request(request) entities = budget_likelihood_repository.get_by_region_and_year( region_id, year, page_sort_params) result = BudgetLikelihoodModelSchema(many=True).dump(entities) return jsonify(result.data)