Commit d3d0ca75 authored by Yohan Boniface's avatar Yohan Boniface

Explorer: add financements page

parent f647dcd7
......@@ -7,6 +7,7 @@
- first rules for "plan de formation"
- explorer: display full text "codes financeur"
- changed qualifiant in certifiant and changed formation.certifiante computing
- explorer: add financements page with financements metadatas
## 0.5.0
......
......@@ -482,3 +482,9 @@ async def test_rules_details(client):
assert not financement['status'][0]['children'][0]['terms'][1]['status']
assert financement['status'][0]['children'][0]['terms'][1]['reason'] == \
"ce n'est pas formation éligible COPANEF"
async def test_explore_financements(client):
resp = await client.get('/explore/financements')
financements = json.loads(resp.body)
assert 'nom' in financements[0]
......@@ -4,10 +4,10 @@ from roll import HttpError, Roll
from roll.extensions import cors
from . import VERSION
from .config import RAW_RULES, SCHEMA, GLOSSARY, NAF
from .config import FINANCEMENTS, GLOSSARY, NAF, RAW_RULES, SCHEMA
from .core import simulate
from .debugging import data_from_lbf_url, make_scenario
from .loggers import logger, log_simulate
from .loggers import log_simulate, logger
from .openapis import OPENAPI
from .routine import get_formation_xml
......@@ -84,6 +84,11 @@ async def explore_glossary(request, response):
response.json = GLOSSARY
@app.route('/explore/financements')
async def explore_financements(request, response):
response.json = FINANCEMENTS
@app.route('/explore/catalog')
async def explore_catalog(request, response):
response.body = await get_formation_xml(request.query.get('id'))
......
<financements>
<ul>
<li each={ this.financements }>
<h3>{ nom }</h3>
<p><strong>Catégories</strong>: { _tags }</p>
<p><strong>Description</strong>: { description }</p>
<p><strong>Démarches</strong>: { demarches }</p>
</ul>
<script>
this.financements = []
this.on('mount', () => this.load())
this.load = () => {
fetch('/explore/financements')
.then((response) => response.json())
.then(data => {
this.financements = data
for (var i = 0; i < this.financements.length; i++) {
// Riot sucks on `tags`…
this.financements[i]['_tags'] = this.financements[i]['tags'].toString()
}
this.update()
})
}
this.mixin(View)
</script>
<style scoped>
h3 {
font-variant: small-caps;
}
li {
border-bottom: 1px solid #f3f3f3;
}
</style>
</financements>
......@@ -4,6 +4,7 @@
<a href="#schema">Schéma</a>
<a href="#rules">Règles de gestion</a>
<a href="#simulate">Simuler</a>
<a href="#financements">Financements</a>
<a href="#tools">Outils</a>
<a href="#glossary">Glossaire</a>
</nav>