mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -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
|
||||
##########################################################################
|
||||
|
||||
def findReplace(self, factIds, src, dst, type=0, isRe=False):
|
||||
def findReplace(self, factIds, src, dst, isRe=False):
|
||||
# find
|
||||
if type == 0:
|
||||
s = "select id, factId, value from fields where factId in %s"
|
||||
else:
|
||||
s = "select 0, id, tags from facts where id in %s"
|
||||
s = "select id, factId, value from fields where factId in %s"
|
||||
if isRe:
|
||||
isRe = re.compile(src)
|
||||
else:
|
||||
if type == 0:
|
||||
s += "and value like :v"
|
||||
else:
|
||||
s += "and tags like :v"
|
||||
s += "and value like :v"
|
||||
rows = self.s.all(s % ids2str(factIds),
|
||||
v="%"+src.replace("%", "%%")+"%")
|
||||
modded = []
|
||||
|
@ -1637,15 +1631,9 @@ where id = :id""", pending)
|
|||
for (id, fid, val) in rows
|
||||
if val.find(src) != -1]
|
||||
# update
|
||||
if type == 0:
|
||||
self.s.statements('update fields set value = :val where id = :id',
|
||||
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],
|
||||
self.s.statements(
|
||||
'update fields set value = :val where id = :id', modded)
|
||||
self.updateCardQACacheFromIds([f['fid'] for f in modded],
|
||||
type="facts")
|
||||
return len(set([f['fid'] for f in modded]))
|
||||
|
||||
|
|
Loading…
Reference in a new issue