Skip to content

Commit

Permalink
fix(services/misc): respect new preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
IgnisDa committed Nov 2, 2024
1 parent 174dd78 commit 4d95fa3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions crates/services/miscellaneous/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ use serde::{Deserialize, Serialize};
use supporting_service::SupportingService;
use tokio::time::{sleep, Duration as TokioDuration};
use traits::{MediaProvider, MediaProviderLanguages, TraceOk};
use user_models::UserReviewScale;
use user_models::{DashboardElementLot, UserReviewScale};
use uuid::Uuid;

type Provider = Box<(dyn MediaProvider + Send + Sync)>;
Expand Down Expand Up @@ -797,7 +797,7 @@ ORDER BY RANDOM() LIMIT 10;
.column(Asterisk)
.from_subquery(
CalendarEvent::find()
.apply_if(deduplicate, |query, _v| {
.apply_if(deduplicate.filter(|&d| d), |query, _v| {
query
.distinct_on([(
AliasedCalendarEvent::Table,
Expand Down Expand Up @@ -946,14 +946,19 @@ ORDER BY RANDOM() LIMIT 10;
(None, from_date.checked_add_days(Days::new(d)))
}
};
let preferences = user_by_id(&user_id, &self.0).await?.preferences.general;
let element = preferences
.dashboard
.iter()
.find(|e| matches!(e.section, DashboardElementLot::Upcoming));
let events = self
.get_calendar_events(
user_id,
true,
to_date,
Some(from_date),
media_limit,
Some(true),
element.and_then(|e| e.deduplicate_media),
)
.await?;
Ok(events)
Expand Down

0 comments on commit 4d95fa3

Please sign in to comment.