Example #1
0
def overview():
    fy = int(
        request_arg('fy', TLMA.cfy, type_func=int, test_func=tests.is_year))
    updates = [('PLEDGE_CREATED_FY', fy), ('BASE_QUERY', '')]
    return dict(data=Tq.query(('CTE', 'CTE_PLEDGE'),
                              cached_timeout=30,
                              updates=updates),
                thisfy=fy)
Example #2
0
def pledge_income_fy(fy=TLMA.cfy):
    fy = request_arg('fy', TLMA.cfy, int, tests.is_year)
    d1, d2 = Tq.format_date(TLMA.fy_range(fy))
    update = [('DOP_START', d1, '\''), ('DOP_END', d2, '\''),
              ('BASE_QUERY', '')]
    data = Tq.query(('CTE', 'PLEDGE_INCOME'),
                    updates=update,
                    cached_timeout=25)
    fys = pledge_dop_fys()
    return dict(data=data, this_fy=fy, fys=fys)
Example #3
0
def pledges(fy=TLMA.cfy):
    d1, d2 = TLMA.fy_range(fy)
    d2 = d2 + datetime.timedelta(days=1)
    d1, d2 = Tq.format_date((d1, d2))
    update = [('CREATED_START', d1, '\''), ('CREATED_END', d2, '\''),
              ('BASE_QUERY', '')]
    data = Tq.query(('CTE', 'PLEDGE_DETAIL'),
                    updates=update,
                    cached_timeout=15)
    fys = pledge_created_fys()
    return dict(data=data, this_fy=fy, fys=fys)
Example #4
0
def delinquency():
    data = {
        'general_warning_days': 90,
        'dd_warning_days': 20,
        'cc_warning_days': 5
    }
    updates = [('BASE_QUERY', '')]
    data['data'] = Tq.query(('CTE', 'PLEDGE_DELINQUENCY'),
                            cached_timeout=10,
                            updates=updates)
    return data
Example #5
0
def revenue_streams():
    fy = request_arg('fy', TLMA.cfy, type_func=int, test_func=tests.is_year)
    # Default to 3 minutes cache or else if the FY in URL is not CFY, then cache it for a longer period of time
    timeout = 180 if fy == TLMA.cfy else 2000
    # Prepare for SQL parameters
    d1, d2 = TLMA.fy_range(fy)
    params = Tq.format_date((d1, d2))
    # data = Tq.query(['PRIVENUE_REVENUE_STREAMS__BASE', 'PRIVENUE_REVENUE_STREAMS_UNION'], *params, cached_timeout=timeout)
    data = Tq.query('PRIVENUE_REVENUE_STREAMS__BASE',
                    *params,
                    cached_timeout=timeout)
    return dict(data=data, thisfy=fy, fys=date_of_payments_fy())
Example #6
0
def comparative():
    fy = request_arg('fy', TLMA.cfy, type_func=int, test_func=tests.is_year)
    # Prepare for SQL parameters
    d1, d2 = TLMA.fy_range(fy)
    progress = (datetime.date.today() - d1).days / (d2 - d1).days

    # Run Query By including 2 financial years
    d1 = TLMA.fy_range(fy - 1)[0]
    params = Tq.format_date((d1, d2))
    # updates = [('PAYMENT_DATE1', d1, '\''), ('PAYMENT_DATE2', d2, '\'')]
    data = Tq.query('PRIVENUE__BASE', *params, cached_timeout=180)
    # Get Budget
    budget = TLMA.budget()
    return dict(cfy=fy, data=data, progress=progress, budget=budget)
Example #7
0
def merchandise_new():
    fy = request_arg('fy', TLMA.cfy, type_func=int, test_func=tests.is_year)
    d1, d2 = TLMA.fy_range(fy)
    # params = (Tq.format_date(d1), Tq.format_date(d2))
    updates = [('DATE_START', Tq.format_date(d1), '\''),
               ('DATE_END', Tq.format_date(d2), '\'')]
    data = Tq.query('JOURNEY_NEW_MERCHANDISE_CUSTOMER',
                    cached_timeout=30,
                    updates=updates)
    return dict(title='Merchandise New Customer Journey',
                data=data,
                dates=(d1, d2),
                thisfy=fy,
                cost=TLMA.acquisition_cost)
Example #8
0
def sourcecode1_active():
    return {'data': Tq.query('SOURCECODE_ACTIVE', cached_timeout=10)}
Example #9
0
def sourcecode1_created():
    # Prepare for SQL parameters
    d1, d2 = TLMA.ccy_date(TLMA.fy12m, 1), TLMA.cfy_end_date
    params = Tq.format_date((d1, d2))
    data = Tq.query('SOURCECODE_CREATED', *params, cached_timeout=10)
    return dict(data=data, d1=d1, d2=d2)
Example #10
0
def contacts_snapshot():
    data = Tq.query('STATS_CONTACTS', cached_timeout=10)
    return dict(title='Contacts', data=data)
Example #11
0
def segments():
    data = Tq.query('STATS_SEGMENT', cached_timeout=120)
    return dict(title='Segments', data=data)