forked from ScoDoc/ScoDoc
Index INE et NIP
This commit is contained in:
parent
b2893a3371
commit
126f719f7a
@ -38,8 +38,8 @@ class Identite(db.Model):
|
|||||||
boursier = db.Column(db.Boolean()) # True si boursier ('O' en ScoDoc7)
|
boursier = db.Column(db.Boolean()) # True si boursier ('O' en ScoDoc7)
|
||||||
photo_filename = db.Column(db.Text())
|
photo_filename = db.Column(db.Text())
|
||||||
# Codes INE et NIP pas unique car le meme etud peut etre ds plusieurs dept
|
# Codes INE et NIP pas unique car le meme etud peut etre ds plusieurs dept
|
||||||
code_nip = db.Column(db.Text())
|
code_nip = db.Column(db.Text(), index=True)
|
||||||
code_ine = db.Column(db.Text())
|
code_ine = db.Column(db.Text(), index=True)
|
||||||
# Ancien id ScoDoc7 pour les migrations de bases anciennes
|
# Ancien id ScoDoc7 pour les migrations de bases anciennes
|
||||||
# ne pas utiliser après migrate_scodoc7_dept_archives
|
# ne pas utiliser après migrate_scodoc7_dept_archives
|
||||||
scodoc7_id = db.Column(db.Text(), nullable=True)
|
scodoc7_id = db.Column(db.Text(), nullable=True)
|
||||||
|
@ -279,6 +279,7 @@ def formsemestre_bulletinetud(
|
|||||||
force_publishing=False,
|
force_publishing=False,
|
||||||
prefer_mail_perso=False,
|
prefer_mail_perso=False,
|
||||||
code_nip=None,
|
code_nip=None,
|
||||||
|
code_ine=None,
|
||||||
):
|
):
|
||||||
if not formsemestre_id:
|
if not formsemestre_id:
|
||||||
flask.abort(404, "argument manquant: formsemestre_id")
|
flask.abort(404, "argument manquant: formsemestre_id")
|
||||||
@ -292,6 +293,14 @@ def formsemestre_bulletinetud(
|
|||||||
etud = models.Identite.query.filter_by(
|
etud = models.Identite.query.filter_by(
|
||||||
code_nip=str(code_nip)
|
code_nip=str(code_nip)
|
||||||
).first_or_404()
|
).first_or_404()
|
||||||
|
elif code_ine:
|
||||||
|
etud = models.Identite.query.filter_by(
|
||||||
|
code_ine=str(code_ine)
|
||||||
|
).first_or_404()
|
||||||
|
else:
|
||||||
|
raise ScoValueError(
|
||||||
|
"Paramètre manquant: spécifier code_nip ou etudid ou code_ine"
|
||||||
|
)
|
||||||
if format == "json":
|
if format == "json":
|
||||||
r = bulletin_but.ResultatsSemestreBUT(formsemestre)
|
r = bulletin_but.ResultatsSemestreBUT(formsemestre)
|
||||||
return jsonify(r.bulletin_etud(etud, formsemestre))
|
return jsonify(r.bulletin_etud(etud, formsemestre))
|
||||||
@ -309,8 +318,10 @@ def formsemestre_bulletinetud(
|
|||||||
sco=ScoData(),
|
sco=ScoData(),
|
||||||
)
|
)
|
||||||
|
|
||||||
if not (etudid or code_nip):
|
if not (etudid or code_nip or code_ine):
|
||||||
raise ScoValueError("Paramètre manquant: spécifier code_nip ou etudid")
|
raise ScoValueError(
|
||||||
|
"Paramètre manquant: spécifier code_nip ou etudid ou code_ine"
|
||||||
|
)
|
||||||
if format == "oldjson":
|
if format == "oldjson":
|
||||||
format = "json"
|
format = "json"
|
||||||
return sco_bulletins.formsemestre_bulletinetud(
|
return sco_bulletins.formsemestre_bulletinetud(
|
||||||
|
34
migrations/versions/f40fbaf5831c_index_ine_et_nip.py
Normal file
34
migrations/versions/f40fbaf5831c_index_ine_et_nip.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
"""index ine et nip
|
||||||
|
|
||||||
|
Revision ID: f40fbaf5831c
|
||||||
|
Revises: 91be8a06d423
|
||||||
|
Create Date: 2022-01-10 15:13:06.867903
|
||||||
|
|
||||||
|
"""
|
||||||
|
from alembic import op
|
||||||
|
import sqlalchemy as sa
|
||||||
|
from sqlalchemy.dialects import postgresql
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "f40fbaf5831c"
|
||||||
|
down_revision = "91be8a06d423"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_index(
|
||||||
|
op.f("ix_identite_code_ine"), "identite", ["code_ine"], unique=False
|
||||||
|
)
|
||||||
|
op.create_index(
|
||||||
|
op.f("ix_identite_code_nip"), "identite", ["code_nip"], unique=False
|
||||||
|
)
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.drop_index(op.f("ix_identite_code_nip"), table_name="identite")
|
||||||
|
op.drop_index(op.f("ix_identite_code_ine"), table_name="identite")
|
||||||
|
# ### end Alembic commands ###
|
Loading…
Reference in New Issue
Block a user