Skip to content

Commit 8caf261

Browse files
refactor based on coderabbitai suggestions
1 parent 00b6a41 commit 8caf261

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/users/dashboards.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ impl Dashboard {
7171
self.dashboard_id = dashboard_id.or_else(|| Some(Ulid::new()));
7272
self.version = Some(CURRENT_DASHBOARD_VERSION.to_string());
7373
self.modified = Some(Utc::now());
74-
self.dashboard_type = Some(DashboardType::Dashboard);
74+
if self.dashboard_type.is_none() {
75+
self.dashboard_type = Some(DashboardType::Dashboard);
76+
}
7577
if self.tiles.is_none() {
7678
self.tiles = Some(Vec::new());
7779
}
@@ -240,7 +242,7 @@ impl Dashboards {
240242
self.0
241243
.write()
242244
.await
243-
.retain(|d| d.dashboard_id.as_ref().is_none_or(|id| *id != dashboard_id));
245+
.retain(|d| d.dashboard_id.map_or(true, |id| id != dashboard_id));
244246

245247
Ok(())
246248
}

0 commit comments

Comments
 (0)