Bugfix: Chapters were saved multiple times
This commit is contained in:
parent
9ece3a7db4
commit
389e1accdd
|
@ -13,7 +13,7 @@ public class StorageCallbacksImpl implements StorageCallbacks {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getDatabaseVersion() {
|
public int getDatabaseVersion() {
|
||||||
return 13;
|
return 14;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -109,5 +109,20 @@ public class StorageCallbacksImpl implements StorageCallbacks {
|
||||||
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
|
db.execSQL("ALTER TABLE " + PodDBAdapter.TABLE_NAME_FEEDS
|
||||||
+ " ADD COLUMN " + PodDBAdapter.KEY_NEXT_PAGE_LINK + " TEXT");
|
+ " ADD COLUMN " + PodDBAdapter.KEY_NEXT_PAGE_LINK + " TEXT");
|
||||||
}
|
}
|
||||||
|
if (oldVersion <= 13) {
|
||||||
|
// remove duplicate rows in "Chapters" table that were created because of a bug.
|
||||||
|
db.execSQL(String.format("DELETE FROM %s WHERE %s NOT IN " +
|
||||||
|
"(SELECT MIN(%s) as %s FROM %s GROUP BY %s,%s,%s,%s,%s)",
|
||||||
|
PodDBAdapter.TABLE_NAME_SIMPLECHAPTERS,
|
||||||
|
PodDBAdapter.KEY_ID,
|
||||||
|
PodDBAdapter.KEY_ID,
|
||||||
|
PodDBAdapter.KEY_ID,
|
||||||
|
PodDBAdapter.TABLE_NAME_SIMPLECHAPTERS,
|
||||||
|
PodDBAdapter.KEY_TITLE,
|
||||||
|
PodDBAdapter.KEY_START,
|
||||||
|
PodDBAdapter.KEY_FEEDITEM,
|
||||||
|
PodDBAdapter.KEY_LINK,
|
||||||
|
PodDBAdapter.KEY_CHAPTER_TYPE));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class FeedItem extends FeedComponent implements ShownotesProvider, Flattr
|
||||||
paymentLink = other.paymentLink;
|
paymentLink = other.paymentLink;
|
||||||
}
|
}
|
||||||
if (other.chapters != null) {
|
if (other.chapters != null) {
|
||||||
if (chapters == null) {
|
if (!hasChapters) {
|
||||||
chapters = other.chapters;
|
chapters = other.chapters;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue