Skip to content

Commit

Permalink
fix ghost notes
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir Yakovlev committed Mar 29, 2012
1 parent 1081f6a commit 4c708d0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions everpad/provider.py
Expand Up @@ -76,8 +76,10 @@ def to_db(self, note, api):
def sync(self):
api = self.api()
if api:
guids = []
for note in api.get_notes():
self.cursor.execute('select updated from notes where guid = ?', (note.guid,))
guids.append(note.guid)
try:
fresh = list(self.cursor)[0][0] == note.updated
if not fresh:
Expand All @@ -86,6 +88,12 @@ def sync(self):
fresh = False
if not fresh:
self.to_db(api.get_note(note.guid), api)
if len(guids):
self.cursor.execute(
'delete from notes where guid not in (%s)' % ', '.join(
['?'] * len(guids)
), guids,
)
self.conn.commit()

def update_note(self, guid, title, content):
Expand Down

0 comments on commit 4c708d0

Please sign in to comment.