Commit d92baddf authored by Emmanuel Raviart's avatar Emmanuel Raviart

The field "dateDepot" of an "amendement" may be null.

parent 1f68786b
Pipeline #93360 passed with stage
in 2 minutes and 2 seconds
......@@ -24,7 +24,7 @@ pub struct Amendement {
#[serde(rename = "corps")]
pub corps: Option<Corps>,
#[serde(rename = "dateDepot")]
pub date_depot: String,
pub date_depot: Option<String>,
#[serde(rename = "dateDistribution")]
pub date_distribution: Option<String>,
#[serde(rename = "etapeTexte")]
......
......@@ -224,14 +224,15 @@ graphql_object!(Query: Context |&self| {
for txtleg in &texteleg.texteleg{
for amds in &txtleg.amendements{
for amd in &amds.amendements{
let tmp_amd = parse_from_str(&amd.date_depot,"%Y-%m-%d").unwrap();
let timestamp_amd = NaiveDateTime::timestamp(&tmp_amd.and_hms(00,00,00));
if timestamp_since_ref <= timestamp_amd {
if timestamp_until_ref >= timestamp_amd {
amendements.push(&amd);
}
match &amd.date_depot {
None => (),
Some(ref date_depot) => {
let tmp_amd = parse_from_str(&date_depot, "%Y-%m-%d").unwrap();
let timestamp_amd = NaiveDateTime::timestamp(&tmp_amd.and_hms(00,00,00));
if timestamp_since_ref <= timestamp_amd && timestamp_amd <= timestamp_until_ref {
amendements.push(&amd);
}
},
}
}
}
......@@ -245,10 +246,15 @@ graphql_object!(Query: Context |&self| {
for txtleg in &texteleg.texteleg{
for amds in &txtleg.amendements{
for amd in &amds.amendements{
let tmp_amd = parse_from_str(&amd.date_depot,"%Y-%m-%d").unwrap();
let timestamp_amd = NaiveDateTime::timestamp(&tmp_amd.and_hms(00,00,00));
if timestamp_since_ref <= timestamp_amd {
amendements.push(&amd);
match &amd.date_depot {
None => (),
Some(ref date_depot) => {
let tmp_amd = parse_from_str(&date_depot,"%Y-%m-%d").unwrap();
let timestamp_amd = NaiveDateTime::timestamp(&tmp_amd.and_hms(00,00,00));
if timestamp_since_ref <= timestamp_amd {
amendements.push(&amd);
}
},
}
}
}
......@@ -270,10 +276,15 @@ graphql_object!(Query: Context |&self| {
for txtleg in &texteleg.texteleg{
for amds in &txtleg.amendements{
for amd in &amds.amendements{
let tmp_amd = parse_from_str(&amd.date_depot,"%Y-%m-%d").unwrap();
let timestamp_amd = NaiveDateTime::timestamp(&tmp_amd.and_hms(00,00,00));
if timestamp_until_ref >= timestamp_amd {
amendements.push(&amd);
match &amd.date_depot {
None => (),
Some(ref date_depot) => {
let tmp_amd = parse_from_str(&date_depot,"%Y-%m-%d").unwrap();
let timestamp_amd = NaiveDateTime::timestamp(&tmp_amd.and_hms(00,00,00));
if timestamp_until_ref >= timestamp_amd {
amendements.push(&amd);
}
},
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment