Skip to content

Commit

Permalink
fix: update reportingPeriod to referencePeriod
Browse files Browse the repository at this point in the history
  • Loading branch information
raimundo-henriques committed Dec 7, 2023
1 parent ea2cd09 commit 05245e6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions endpoint/src/datamodel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ pub struct CarbonFootprint {
#[serde(skip_serializing_if = "Option::is_none")]
pub boundary_processes_description: Option<String>,

pub reporting_period_start: DateTime<Utc>,
pub reporting_period_end: DateTime<Utc>,
pub reference_period_start: DateTime<Utc>,
pub reference_period_end: DateTime<Utc>,

#[serde(flatten)]
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
12 changes: 6 additions & 6 deletions endpoint/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,11 @@ fn filtered_data(filter: Option<&'_ str>) -> Result<Vec<ProductFootprint>, Strin
.unwrap_or_default()
})
.unwrap_or_default(),
"pcf/reportingPeriodStart" => {
pf.pcf.reporting_period_start.to_string() == value
"pcf/referencePeriodStart" => {
pf.pcf.reference_period_start.to_string() == value
}
"pcf/reportingPeriodEnd" => {
pf.pcf.reporting_period_end.to_string() == value
"pcf/referencePeriodEnd" => {
pf.pcf.reference_period_end.to_string() == value
}
_ => {
return Err(format!("Unsupported property {property}"));
Expand All @@ -235,8 +235,8 @@ fn filtered_data(filter: Option<&'_ str>) -> Result<Vec<ProductFootprint>, Strin
let v = match property {
"created" => Some(pf.created),
"updated" => pf.updated,
"pcf/reportingPeriodStart" => Some(pf.pcf.reporting_period_start),
"pcf/reportingPeriodEnd" => Some(pf.pcf.reporting_period_end),
"pcf/referencePeriodStart" => Some(pf.pcf.reference_period_start),
"pcf/referencePeriodEnd" => Some(pf.pcf.reference_period_end),
_ => {
return Err(format!("Unsupported property {property}"));
}
Expand Down
4 changes: 2 additions & 2 deletions endpoint/src/sample_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ lazy_static! {
name: String::from("Ecoinvent").into(),
version: String::from("1.2.3").into(),
}])),
reporting_period_start: *TIME_PERIOD_START,
reporting_period_end: *TIME_PERIOD_END,
reference_period_start: *TIME_PERIOD_START,
reference_period_end: *TIME_PERIOD_END,
/*geography_region_or_subregion: None,
geography_country: Some(ISO3166CC(String::from("FR"))),
geography_country_subdivision: None, */
Expand Down

0 comments on commit 05245e6

Please sign in to comment.