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 {
|
impl Collection {
|
||||||
pub fn browser_row_for_id(&mut self, id: i64) -> Result<Row> {
|
pub fn browser_row_for_id(&mut self, id: i64) -> Result<Row> {
|
||||||
if self.get_bool(BoolKey::BrowserTableShowNotesMode) {
|
if self.get_bool(BoolKey::BrowserTableShowNotesMode) {
|
||||||
|
@ -417,12 +425,7 @@ impl RowContext for CardRowContext<'_> {
|
||||||
3 => Color::FlagGreen,
|
3 => Color::FlagGreen,
|
||||||
4 => Color::FlagBlue,
|
4 => Color::FlagBlue,
|
||||||
_ => {
|
_ => {
|
||||||
if self
|
if self.note.is_marked() {
|
||||||
.note
|
|
||||||
.tags
|
|
||||||
.iter()
|
|
||||||
.any(|tag| tag.eq_ignore_ascii_case("marked"))
|
|
||||||
{
|
|
||||||
Color::Marked
|
Color::Marked
|
||||||
} else if self.card.queue == CardQueue::Suspended {
|
} else if self.card.queue == CardQueue::Suspended {
|
||||||
Color::Suspended
|
Color::Suspended
|
||||||
|
@ -534,12 +537,7 @@ impl RowContext for NoteRowContext<'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn get_row_color(&self) -> Color {
|
fn get_row_color(&self) -> Color {
|
||||||
if self
|
if self.note.is_marked() {
|
||||||
.note
|
|
||||||
.tags
|
|
||||||
.iter()
|
|
||||||
.any(|tag| tag.eq_ignore_ascii_case("marked"))
|
|
||||||
{
|
|
||||||
Color::Marked
|
Color::Marked
|
||||||
} else {
|
} else {
|
||||||
Color::Default
|
Color::Default
|
||||||
|
|
Loading…
Reference in a new issue