Compare commits

...

2 Commits

Author SHA1 Message Date
Joseph Silva
a02b0c0e7f
fix user_scheduled_post_count function 2024-09-25 13:07:47 -07:00
Joseph Silva
65e63c39ed
fix argument order 2024-09-25 12:32:42 -07:00

View File

@ -258,9 +258,9 @@ impl Post {
post::table post::table
.inner_join(person::table) .inner_join(person::table)
.inner_join(community::table) .inner_join(community::table)
// find all posts which have scheduled_publish_time that is in the past // find all posts which have scheduled_publish_time that is in the future
.filter(post::scheduled_publish_time.is_not_null()) .filter(post::scheduled_publish_time.is_not_null())
.filter(coalesce(post::scheduled_publish_time, now()).lt(now())) .filter(coalesce(post::scheduled_publish_time, now()).gt(now()))
// make sure the post and community are still around // make sure the post and community are still around
.filter(not(post::deleted.or(post::removed))) .filter(not(post::deleted.or(post::removed)))
.filter(not(community::removed.or(community::deleted))) .filter(not(community::removed.or(community::deleted)))
@ -543,7 +543,7 @@ mod tests {
.unwrap(); .unwrap();
// Scheduled post count // Scheduled post count
let scheduled_post_count = Post::user_scheduled_post_count(pool, inserted_person.id) let scheduled_post_count = Post::user_scheduled_post_count(inserted_person.id, pool)
.await .await
.unwrap(); .unwrap();
assert_eq!(1, scheduled_post_count); assert_eq!(1, scheduled_post_count);