mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Refactor get_row_color()
This commit is contained in:
parent
5e151cdc42
commit
99e28068f9
1 changed files with 10 additions and 12 deletions
|
@ -193,6 +193,14 @@ impl Card {
|
|||
}
|
||||
}
|
||||
|
||||
impl Note {
|
||||
fn is_marked(&self) -> bool {
|
||||
self.tags
|
||||
.iter()
|
||||
.any(|tag| tag.eq_ignore_ascii_case("marked"))
|
||||
}
|
||||
}
|
||||
|
||||
impl Collection {
|
||||
pub fn browser_row_for_id(&mut self, id: i64) -> Result<Row> {
|
||||
if self.get_bool(BoolKey::BrowserTableShowNotesMode) {
|
||||
|
@ -417,12 +425,7 @@ impl RowContext for CardRowContext<'_> {
|
|||
3 => Color::FlagGreen,
|
||||
4 => Color::FlagBlue,
|
||||
_ => {
|
||||
if self
|
||||
.note
|
||||
.tags
|
||||
.iter()
|
||||
.any(|tag| tag.eq_ignore_ascii_case("marked"))
|
||||
{
|
||||
if self.note.is_marked() {
|
||||
Color::Marked
|
||||
} else if self.card.queue == CardQueue::Suspended {
|
||||
Color::Suspended
|
||||
|
@ -534,12 +537,7 @@ impl RowContext for NoteRowContext<'_> {
|
|||
}
|
||||
|
||||
fn get_row_color(&self) -> Color {
|
||||
if self
|
||||
.note
|
||||
.tags
|
||||
.iter()
|
||||
.any(|tag| tag.eq_ignore_ascii_case("marked"))
|
||||
{
|
||||
if self.note.is_marked() {
|
||||
Color::Marked
|
||||
} else {
|
||||
Color::Default
|
||||
|
|
Loading…
Reference in a new issue