mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-14 00:00:59 +00:00
Bugfix: duplicate entries for leaderboards and marks
Implemented a check, if a leaderboard is available. If not the checkindata may be stored in local database.
This commit is contained in:
1 parent
a0141d24e1
commit
8bd72a708b
2 files changed
+10
-10
No files matched your search
+6
-4
@@ -79,10 +79,12 @@ public class HomeFragment extends AbstractHomeFragment implements
|
||||
|
||||
private void checkinWithApiAndStartRegattaActivity(CheckinData checkinData) {
|
||||
try {
|
||||
DatabaseHelper.getInstance().storeCheckinRow(getActivity(),
|
||||
checkinData.marks, checkinData.getLeaderboard(),
|
||||
checkinData.getCheckinUrl());
|
||||
adapter.notifyDataSetChanged();
|
||||
if(DatabaseHelper.getInstance().markLeaderboardCombnationAvailable(getActivity(), checkinData.checkinDigest)) {
|
||||
DatabaseHelper.getInstance().storeCheckinRow(getActivity(),
|
||||
checkinData.marks, checkinData.getLeaderboard(),
|
||||
checkinData.getCheckinUrl());
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
} catch (DatabaseHelper.GeneralDatabaseHelperException e) {
|
||||
ExLog.e(getActivity(), TAG,
|
||||
|
||||
+4
-6
@@ -223,14 +223,12 @@ public class DatabaseHelper {
|
||||
|
||||
public boolean markLeaderboardCombnationAvailable(Context context, String checkinDigest) {
|
||||
|
||||
ContentResolver cr = context.getContentResolver();
|
||||
String sel = "leaderboards.leaderboard_checkin_digest = \"" + checkinDigest;
|
||||
Cursor lc = context.getContentResolver().query(Leaderboard.CONTENT_URI, null,
|
||||
Leaderboard.LEADERBOARD_CHECKIN_DIGEST + " = \"" + checkinDigest + "\"", null, null);
|
||||
|
||||
Cursor cursor = cr.query(AnalyticsContract.Leaderboard.CONTENT_URI, null, sel, null, null);
|
||||
int count = lc.getCount();
|
||||
|
||||
int count = cursor.getCount();
|
||||
|
||||
cursor.close();
|
||||
lc.close();
|
||||
return count == 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user