added removeEmptyNotes (#221)
* clearUnusedTags and replaceTags are added * added clearUnusedTags and replaceTags * added clearUnusedTags and replaceTags * removed whitespaces and indentations * removed white spaces and indentations * added removeEmptyNotes
This commit is contained in:
parent
311cb7e192
commit
c55281d67a
@ -433,3 +433,24 @@
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
||||
* **removeEmptyNotes**
|
||||
|
||||
Removes all the empty notes for the current user.
|
||||
|
||||
*Sample request*:
|
||||
```json
|
||||
{
|
||||
"action": "removeEmptyNotes",
|
||||
"version": 6
|
||||
}
|
||||
```
|
||||
|
||||
*Sample result*:
|
||||
```json
|
||||
{
|
||||
"result": null,
|
||||
"error": null
|
||||
}
|
||||
```
|
||||
|
@ -1085,7 +1085,12 @@ class AnkiConnect:
|
||||
finally:
|
||||
self.stopEditing()
|
||||
|
||||
|
||||
@util.api()
|
||||
def removeEmptyNotes(self):
|
||||
for model in self.collection().models.all():
|
||||
if self.collection().models.useCount(model) == 0:
|
||||
self.collection().models.rem(model)
|
||||
self.window().requireReset()
|
||||
|
||||
|
||||
@util.api()
|
||||
|
Loading…
Reference in New Issue
Block a user