mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
remove tag replace from find&replace
This commit is contained in:
parent
fc66e909ae
commit
bc7b4e4d18
1 changed files with 6 additions and 18 deletions
24
anki/deck.py
24
anki/deck.py
|
@ -1610,19 +1610,13 @@ where id = :id""", pending)
|
||||||
# Find and replace
|
# Find and replace
|
||||||
##########################################################################
|
##########################################################################
|
||||||
|
|
||||||
def findReplace(self, factIds, src, dst, type=0, isRe=False):
|
def findReplace(self, factIds, src, dst, isRe=False):
|
||||||
# find
|
# find
|
||||||
if type == 0:
|
s = "select id, factId, value from fields where factId in %s"
|
||||||
s = "select id, factId, value from fields where factId in %s"
|
|
||||||
else:
|
|
||||||
s = "select 0, id, tags from facts where id in %s"
|
|
||||||
if isRe:
|
if isRe:
|
||||||
isRe = re.compile(src)
|
isRe = re.compile(src)
|
||||||
else:
|
else:
|
||||||
if type == 0:
|
s += "and value like :v"
|
||||||
s += "and value like :v"
|
|
||||||
else:
|
|
||||||
s += "and tags like :v"
|
|
||||||
rows = self.s.all(s % ids2str(factIds),
|
rows = self.s.all(s % ids2str(factIds),
|
||||||
v="%"+src.replace("%", "%%")+"%")
|
v="%"+src.replace("%", "%%")+"%")
|
||||||
modded = []
|
modded = []
|
||||||
|
@ -1637,15 +1631,9 @@ where id = :id""", pending)
|
||||||
for (id, fid, val) in rows
|
for (id, fid, val) in rows
|
||||||
if val.find(src) != -1]
|
if val.find(src) != -1]
|
||||||
# update
|
# update
|
||||||
if type == 0:
|
self.s.statements(
|
||||||
self.s.statements('update fields set value = :val where id = :id',
|
'update fields set value = :val where id = :id', modded)
|
||||||
modded)
|
self.updateCardQACacheFromIds([f['fid'] for f in modded],
|
||||||
self.updateCardQACacheFromIds([f['fid'] for f in modded],
|
|
||||||
type="facts")
|
|
||||||
else:
|
|
||||||
self.s.statements("update facts set tags = :val where id = :fid",
|
|
||||||
modded)
|
|
||||||
self.updateCardQACacheFromIds([f['fid'] for f in modded],
|
|
||||||
type="facts")
|
type="facts")
|
||||||
return len(set([f['fid'] for f in modded]))
|
return len(set([f['fid'] for f in modded]))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue