Order the project picker by most recently selected
This commit is contained in:
@@ -234,19 +234,19 @@ final class SwitcherModel {
|
||||
}
|
||||
return a.i < b.i
|
||||
}
|
||||
let focused = store.focusedProject()?.id
|
||||
let used = store.projects.enumerated().map { i, p in
|
||||
(i: i, project: p, at: p.id == focused ? Double.infinity : ((store.tasks[p.id] ?? []).map { visits[$0.id] ?? 0 } + [visits[p.id] ?? 0]).max()!)
|
||||
}
|
||||
let recent = used.sorted { $0.at != $1.at ? $0.at > $1.at : $0.i < $1.i }.map(\.project)
|
||||
let images = store.images.images(imageKey).count
|
||||
var rows: [SwitcherRow] = []
|
||||
if images == 0 {
|
||||
rows = matches.map { SwitcherRow(id: "task:\($0.task.id)", kind: .task($0.project, $0.task, $0.count)) }
|
||||
for p in (targets ?? store.projects) where includes("\(p.name) project".lowercased(), q) {
|
||||
for p in (targets ?? recent) where includes("\(p.name) project".lowercased(), q) {
|
||||
rows.append(SwitcherRow(id: "project:\(p.id)", kind: .project(p)))
|
||||
}
|
||||
}
|
||||
let focused = store.focusedProject()?.id
|
||||
let used = store.projects.enumerated().map { i, p in
|
||||
(i: i, project: p, at: p.id == focused ? Double.infinity : (store.tasks[p.id] ?? []).map { visits[$0.id] ?? 0 }.max() ?? 0)
|
||||
}
|
||||
let recent = used.sorted { $0.at != $1.at ? $0.at > $1.at : $0.i < $1.i }.map(\.project)
|
||||
let workflow = images == 0 ? workflowMatch(title) : nil
|
||||
for project in targets ?? recent {
|
||||
if title.isEmpty && images == 0 {
|
||||
|
||||
Reference in New Issue
Block a user