Example #1
0
    def GET(self):
        from util import AntiFraud
        input = web.input()
        rooms = input.get("rooms", "")
        rooms = rooms.replace(" ", "+")

        analyses = handler.filteredAnalyses(web)
        analyses = AntiFraud.getWithoutDuplicities(analyses)

        longLegend = "(%s)" % len(analyses)
        legend = ""
        if rooms:
            analyses = [a for a in analyses if a["rooms"].startswith(rooms)]
            groupCounts = viewer.getGroupCounts(analyses)
            longLegend = ", ".join("%s (%s)" % pair for pair in groupCounts)
            legend = ", ".join(pair[0] for pair in groupCounts)

        property = "price"
        unit = 100000
        minMax = (1*10**6, 4*10**6)
        dataJs1, maxCount1 = viewer.getHistogramDataJs(analyses, property,
                unit, legend=legend, minMax=minMax)

        minMax = (4*10**6, 7*10**6)
        dataJs2, maxCount2 = viewer.getHistogramDataJs(analyses, property,
                unit, legend=legend, minMax=minMax)

        maxCount = max(10, maxCount1, maxCount2)
        print formatter.page("histogram", _(u"Histogram of Prague Homes"),
            type="withFilter")(dataJs1, dataJs2, maxCount, longLegend)
Example #2
0
    def GET(self):
        from util import report
        from src import feeder
        web.header("Content-Type", "application/atom+xml; charset=utf-8")
        analyses = handler.filteredAnalyses(web)
        analyses = feeder.getExportable(analyses)

        url = "http://jakybyt.cz" + web.ctx.fullpath
        print formatter.RENDER.feed(analyses, report.getMtime(), url)
Example #3
0
    def GET(self):
        from util import AntiFraud
        analyses = handler.filteredAnalyses(web)
        analyses = AntiFraud.getWithoutDuplicities(analyses)
        timeline = charter.getTimeline(analyses)
        motionDataJs = formatter.RENDER.motionData(timeline)

        print formatter.page("chart", _(u"Chart of home prices in Prague"),
            type="withFilter")(motionDataJs)
Example #4
0
    def GET(self):
        web.header('Content-Type', "text/javascript; charset=utf-8")
        input = web.input("sw", "ne", "zoom");
        bounds = handler.validBounds(input.sw, input.ne)
        zoom = handler.validN(input.zoom)

        model = mapper.getClusterModel(handler.filteredAnalyses(web),
                zoom, bounds)
        MapFormatter.enhanceClusterModel(model)
        dumpJson(model)
Example #5
0
    def GET(self):
        input = web.input(limit=100)
        limit = handler.validN(input.limit)
        analyses = handler.filteredAnalyses(web, limit)
        days = lister.getListingByDays(analyses)

        ungettext = _.im_self.ungettext
        counting = ungettext(u"Showing one home.", u"Showing %(count)s homes.",
                    len(analyses)) % {"count": len(analyses)}
        print formatter.page("item_list", _(u"Latest home offers in Prague"),
                type="withFilter")(days, counting)
Example #6
0
    def GET(self):
        sight = None
        input = web.input()
        homeUrl = input.get("byt")
        if homeUrl:
            homeUrl = homeUrl.replace(" ", "+")
            analyses = handler.filteredAnalyses(web)
            for analysis in analyses:
                if analysis["url"] == homeUrl:
                    sight = MapFormatter.createSight(analysis)
                    break
            else:
                logging.info("No such home: %r", homeUrl)

        print formatter.page("map", _(u"Map of Prague homes"),
                type="withFilter toggleFilter")(
                        config.MAP_KEY, locality.GEO_BOUNDS, sight)