mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
Fix reparenting message with tags
This commit is contained in:
parent
52347819dd
commit
199958c1c5
1 changed files with 10 additions and 1 deletions
|
@ -40,14 +40,23 @@ impl Collection {
|
||||||
) -> Result<usize> {
|
) -> Result<usize> {
|
||||||
let usn = self.usn()?;
|
let usn = self.usn()?;
|
||||||
let mut matcher = TagMatcher::new(&join_tags(tags_to_reparent))?;
|
let mut matcher = TagMatcher::new(&join_tags(tags_to_reparent))?;
|
||||||
|
|
||||||
let old_to_new_names = old_to_new_names(tags_to_reparent, new_parent);
|
let old_to_new_names = old_to_new_names(tags_to_reparent, new_parent);
|
||||||
if old_to_new_names.is_empty() {
|
if old_to_new_names.is_empty() {
|
||||||
return Ok(0);
|
return Ok(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
let matched_notes = self
|
let matched_notes = self
|
||||||
.storage
|
.storage
|
||||||
.get_note_tags_by_predicate(|tags| matcher.is_match(tags))?;
|
.get_note_tags_by_predicate(|tags| matcher.is_match(tags))?;
|
||||||
let match_count = matched_notes.len();
|
|
||||||
|
let mut match_count = 0;
|
||||||
|
for name in old_to_new_names.keys() {
|
||||||
|
if &UniCase::new(old_to_new_names.get(name).unwrap()) != name {
|
||||||
|
match_count += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if match_count == 0 {
|
if match_count == 0 {
|
||||||
// no matches; exit early so we don't clobber the empty tag entries
|
// no matches; exit early so we don't clobber the empty tag entries
|
||||||
return Ok(0);
|
return Ok(0);
|
||||||
|
|
Loading…
Reference in a new issue