Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
parlapi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
David Guillot
parlapi
Commits
6beaf723
Commit
6beaf723
authored
Feb 10, 2017
by
Nicolas Joyard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gestion last mod sur job amendements
parent
4d86c6ea
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
40 deletions
+44
-40
parlapi/jobs/an_amendements.py
parlapi/jobs/an_amendements.py
+42
-40
parlapi/models.py
parlapi/models.py
+2
-0
No files found.
parlapi/jobs/an_amendements.py
View file @
6beaf723
...
...
@@ -24,7 +24,8 @@ class ImportAmendementsJob(BaseANJob):
def
save_texte
(
self
,
json
):
self
.
current
=
u'Texte %s'
%
json
[
'refTexteLegislatif'
]
document
=
self
.
get_cached
(
Document
,
json
[
'refTexteLegislatif'
])
document
=
self
.
save
(
Document
,
json
[
'refTexteLegislatif'
])
amendements
=
json
[
'amendements'
][
'amendement'
]
if
isinstance
(
amendements
,
dict
):
...
...
@@ -35,56 +36,57 @@ class ImportAmendementsJob(BaseANJob):
def
save_amendement
(
self
,
json
,
document
):
self
.
current
=
u'Amendement %s'
%
json
[
'uid'
]
am
=
self
.
get_cached
(
Amendement
,
json
[
'uid'
])
am
.
document
=
document
id
=
json
[
'identifiant'
]
am
.
numero
=
int
(
id
[
'numero'
])
am
.
num_rect
=
int
(
id
[
'numRect'
])
am
.
organe
=
self
.
get_cached
(
Organe
,
id
[
'saisine'
][
'organeExamen'
])
am
.
legislature
=
self
.
get_cached
(
Legislature
,
int
(
id
[
'legislature'
]))
am
.
numero_long
=
json
[
'numeroLong'
]
am
.
etape_texte
=
json
[
'etapeTexte'
]
am
.
tri
=
json
[
'triAmendement'
]
am
.
cardinal_multiples
=
int
(
json
[
'cardinaliteAmdtMultiples'
])
fr
=
json
[
'pointeurFragmentTexte'
]
dv
=
fr
[
'division'
]
co
=
json
[
'corps'
]
lo
=
json
[
'loiReference'
]
if
json
.
get
(
'amendementParent'
,
None
):
am
.
amendement_parent
=
\
self
.
get_cached
(
Amendement
,
json
[
'amendementParent'
])
data
=
{
'amendement_parent'
:
None
,
'article_99'
:
int
(
json
[
'article99'
])
>
0
,
'cardinal_multiples'
:
int
(
json
[
'cardinaliteAmdtMultiples'
]),
'code_loi'
:
lo
[
'codeLoi'
],
'code_loi_division'
:
lo
[
'divisionCodeLoi'
],
'corps_dispositif'
:
co
.
get
(
'dispositif'
,
None
),
'corps_expose'
:
co
.
get
(
'exposeSommaire'
,
None
),
'date_depot'
:
self
.
parse_date
(
json
[
'dateDepot'
]),
'date_distribution'
:
self
.
parse_date
(
json
[
'dateDistribution'
]),
'date_sort'
:
None
,
'division_alinea'
:
None
,
'division_alinea_position'
:
None
,
'division_article_additionnel'
:
dv
.
get
(
'articleAdditionnel'
,
'0'
)
!=
'0'
,
'division_chapitre_additionnel'
:
dv
.
get
(
'chapitreAdditionnel'
,
'0'
)
!=
'0'
,
'division_position'
:
dv
[
'avant_A_Apres'
],
'division_texte'
:
dv
[
'titre'
],
'document'
:
document
,
'etape_texte'
:
json
[
'etapeTexte'
],
'etat'
:
json
[
'etat'
],
'legislature'
:
self
.
save
(
Legislature
,
int
(
id
[
'legislature'
])),
'num_rect'
:
int
(
id
[
'numRect'
]),
'numero'
:
int
(
id
[
'numero'
]),
'numero_long'
:
json
[
'numeroLong'
],
'organe'
:
self
.
save
(
Organe
,
id
[
'saisine'
][
'organeExamen'
]),
'sort'
:
None
,
'tri'
:
json
[
'triAmendement'
],
}
am
.
etat
=
json
[
'etat'
]
am
.
article_99
=
int
(
json
[
'article99'
])
>
0
if
json
.
get
(
'amendementParent'
,
None
):
data
[
'amendement_parent'
]
=
\
self
.
save
(
Amendement
,
json
[
'amendementParent'
])
so
=
json
[
'sort'
]
if
so
:
am
.
sort
=
so
[
'sortEnSeance'
]
am
.
date_sort
=
self
.
parse_date
(
so
[
'dateSaisie'
])
data
[
'sort'
]
=
so
[
'sortEnSeance'
]
data
[
'date_sort'
]
=
self
.
parse_date
(
so
[
'dateSaisie'
])
fr
=
json
[
'pointeurFragmentTexte'
]
dv
=
fr
[
'division'
]
am
.
division_texte
=
dv
[
'titre'
]
am
.
division_position
=
dv
[
'avant_A_Apres'
]
am
.
division_chapitre_additionnel
=
\
dv
.
get
(
'chapitreAdditionnel'
,
'0'
)
!=
'0'
am
.
division_article_additionnel
=
\
dv
.
get
(
'articleAdditionnel'
,
'0'
)
!=
'0'
al
=
fr
[
'alinea'
]
if
al
and
al
.
get
(
'numero'
,
None
):
am
.
division_alinea
=
int
(
al
[
'numero'
])
am
.
division_alinea_position
=
al
[
'avant_A_Apres'
]
co
=
json
[
'corps'
]
am
.
corps_dispositif
=
co
.
get
(
'dispositif'
,
None
)
am
.
corps_expose
=
co
.
get
(
'exposeSommaire'
,
None
)
lo
=
json
[
'loiReference'
]
am
.
code_loi
=
lo
[
'codeLoi'
]
am
.
code_loi_division
=
lo
[
'divisionCodeLoi'
]
data
[
'division_alinea'
]
=
int
(
al
[
'numero'
])
data
[
'division_alinea_position'
]
=
al
[
'avant_A_Apres'
]
am
.
date_depot
=
self
.
parse_date
(
json
[
'dateDepot'
])
am
.
date_distribution
=
self
.
parse_date
(
json
[
'dateDistribution'
])
am
=
self
.
save
(
Amendement
,
json
[
'uid'
],
data
)
def
run
(
app
,
force
=
False
,
file
=
None
):
...
...
parlapi/models.py
View file @
6beaf723
...
...
@@ -238,6 +238,7 @@ class Document(db.Model):
__tablename__
=
'documents'
query_class
=
SearchableQuery
_last_modified
=
db
.
Column
(
db
.
DateTime
)
id
=
db
.
Column
(
db
.
Unicode
,
primary_key
=
True
)
date_creation
=
db
.
Column
(
db
.
Date
)
...
...
@@ -372,6 +373,7 @@ class Amendement(db.Model):
__tablename__
=
'amendements'
query_class
=
SearchableQuery
_last_modified
=
db
.
Column
(
db
.
DateTime
)
id
=
db
.
Column
(
db
.
Unicode
,
primary_key
=
True
)
numero
=
db
.
Column
(
db
.
Integer
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment