fix updates route (#667)

This commit is contained in:
Geometrically
2023-08-04 22:52:17 -07:00
committed by GitHub
parent c370da2fef
commit 5637d37ee1
2 changed files with 4 additions and 2 deletions

View File

@@ -207,7 +207,7 @@ pub async fn process_payout(
client: &clickhouse::Client, client: &clickhouse::Client,
) -> Result<(), ApiError> { ) -> Result<(), ApiError> {
let start: DateTime<Utc> = DateTime::from_utc( let start: DateTime<Utc> = DateTime::from_utc(
Utc::now() (Utc::now() - Duration::days(1))
.date_naive() .date_naive()
.and_hms_nano_opt(0, 0, 0, 0) .and_hms_nano_opt(0, 0, 0, 0)
.unwrap_or_default(), .unwrap_or_default(),

View File

@@ -305,7 +305,7 @@ pub async fn get_update_from_hash(
bool bool
}) })
.sorted_by(|a, b| b.inner.date_published.cmp(&a.inner.date_published)) .sorted_by(|a, b| a.inner.date_published.cmp(&b.inner.date_published))
.collect::<Vec<_>>(); .collect::<Vec<_>>();
if let Some(first) = versions.pop() { if let Some(first) = versions.pop() {
@@ -484,6 +484,7 @@ pub async fn update_files(
for file in files.iter().filter(|x| x.project_id == project.inner.id) { for file in files.iter().filter(|x| x.project_id == project.inner.id) {
let version = all_versions let version = all_versions
.iter() .iter()
.filter(|x| x.inner.project_id == file.project_id)
.filter(|x| { .filter(|x| {
let mut bool = true; let mut bool = true;
@@ -589,6 +590,7 @@ pub async fn update_individual_files(
if let Some(query_file) = update_data.hashes.iter().find(|x| &x.hash == hash) { if let Some(query_file) = update_data.hashes.iter().find(|x| &x.hash == hash) {
let version = all_versions let version = all_versions
.iter() .iter()
.filter(|x| x.inner.project_id == file.project_id)
.filter(|x| { .filter(|x| {
let mut bool = true; let mut bool = true;