mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-23 16:53:04 +02:00
get tuple data entries only from the selected user.
This commit is contained in:
@@ -160,7 +160,7 @@ public class OpenScale {
|
|||||||
|
|
||||||
public ScaleData[] getTupleScaleData(long id)
|
public ScaleData[] getTupleScaleData(long id)
|
||||||
{
|
{
|
||||||
return scaleDB.getTupleDataEntry(id);
|
return scaleDB.getTupleDataEntry(getSelectedScaleUser().id, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int addScaleData(ScaleData scaleData) {
|
public int addScaleData(ScaleData scaleData) {
|
||||||
|
@@ -172,7 +172,7 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
|||||||
dbWrite.update(TABLE_NAME, values, COLUMN_NAME_ID + "=" + id, null);
|
dbWrite.update(TABLE_NAME, values, COLUMN_NAME_ID + "=" + id, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ScaleData[] getTupleDataEntry(long id)
|
public ScaleData[] getTupleDataEntry(int userId, long id)
|
||||||
{
|
{
|
||||||
Cursor cursorScaleDB;
|
Cursor cursorScaleDB;
|
||||||
|
|
||||||
@@ -182,8 +182,8 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
|||||||
cursorScaleDB = dbRead.query(
|
cursorScaleDB = dbRead.query(
|
||||||
TABLE_NAME, // The table to query
|
TABLE_NAME, // The table to query
|
||||||
projection, // The columns to return
|
projection, // The columns to return
|
||||||
COLUMN_NAME_ID + "=?", // The columns for the WHERE clause
|
COLUMN_NAME_USER_ID + "=? AND " + COLUMN_NAME_ID + "=?", // The columns for the WHERE clause
|
||||||
new String[] {Long.toString(id)}, // The values for the WHERE clause
|
new String[] {Integer.toString(userId), Long.toString(id)}, // The values for the WHERE clause
|
||||||
null, // don't group the rows
|
null, // don't group the rows
|
||||||
null, // don't filter by row groups
|
null, // don't filter by row groups
|
||||||
null, // The sort order
|
null, // The sort order
|
||||||
@@ -201,8 +201,8 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
|||||||
cursorScaleDB = dbRead.query(
|
cursorScaleDB = dbRead.query(
|
||||||
TABLE_NAME, // The table to query
|
TABLE_NAME, // The table to query
|
||||||
projection, // The columns to return
|
projection, // The columns to return
|
||||||
COLUMN_NAME_DATE_TIME + "<? AND " + COLUMN_NAME_ENABLE + "=1", // The columns for the WHERE clause
|
COLUMN_NAME_USER_ID + "=? AND " + COLUMN_NAME_DATE_TIME + "<? AND " + COLUMN_NAME_ENABLE + "=1", // The columns for the WHERE clause
|
||||||
new String[] {formatDateTime.format(tupleScaleData[1].getDateTime())}, // The values for the WHERE clause
|
new String[] {Integer.toString(userId), formatDateTime.format(tupleScaleData[1].getDateTime())}, // The values for the WHERE clause
|
||||||
null, // don't group the rows
|
null, // don't group the rows
|
||||||
null, // don't filter by row groups
|
null, // don't filter by row groups
|
||||||
COLUMN_NAME_DATE_TIME + " DESC", // The sort order
|
COLUMN_NAME_DATE_TIME + " DESC", // The sort order
|
||||||
@@ -222,8 +222,8 @@ public class ScaleDatabase extends SQLiteOpenHelper {
|
|||||||
cursorScaleDB = dbRead.query(
|
cursorScaleDB = dbRead.query(
|
||||||
TABLE_NAME, // The table to query
|
TABLE_NAME, // The table to query
|
||||||
projection, // The columns to return
|
projection, // The columns to return
|
||||||
COLUMN_NAME_DATE_TIME + ">? AND " + COLUMN_NAME_ENABLE + "=1", // The columns for the WHERE clause
|
COLUMN_NAME_USER_ID + "=? AND " + COLUMN_NAME_DATE_TIME + ">? AND " + COLUMN_NAME_ENABLE + "=1", // The columns for the WHERE clause
|
||||||
new String[] {formatDateTime.format(tupleScaleData[1].getDateTime())}, // The values for the WHERE clause
|
new String[] {Integer.toString(userId), formatDateTime.format(tupleScaleData[1].getDateTime())}, // The values for the WHERE clause
|
||||||
null, // don't group the rows
|
null, // don't group the rows
|
||||||
null, // don't filter by row groups
|
null, // don't filter by row groups
|
||||||
COLUMN_NAME_DATE_TIME, // The sort order
|
COLUMN_NAME_DATE_TIME, // The sort order
|
||||||
|
Reference in New Issue
Block a user