Example #1
0
def jobs_region(region_id):
    region = [reg for reg in REGIONS if reg['id'] == region_id][0]
    with db:
        metrics = dict(**Metric.as_dict(), **Job.aggregate_metrics())
        jobs = Job.region_listing(region['name'])
    return render_template('jobs_region.html',
                           nav_active='jobs',
                           subnav_tabs=JOBS_SUBNAV_TABS,
                           subnav_active='jobs',
                           jobs=jobs,
                           region=region,
                           regions=REGIONS,
                           metrics=metrics,
                           thumbnail=thumbnail(title=f"Práce v\u00a0IT pro začátečníky —\u00a0{region['name']}"))
Example #2
0
def test_region_listing(db_connection):
    job1 = create_job('1',
                      sort_rank=30,
                      locations=[dict(name='Brno', region='Brno')])
    job2 = create_job(
        '2',  # noqa
        locations=[dict(name='Praha', region='Praha')])
    job3 = create_job('3',
                      sort_rank=20,
                      locations=[dict(name='Brno', region='Brno')])
    job4 = create_job('4',
                      sort_rank=10,
                      locations=[dict(name='Brno', region='Brno')])

    assert list(Job.region_listing('Brno')) == [job1, job3, job4]