Closed
Description
Describe the bug
Hi Team,
some of our users are not able to see their old data which is older than a week.
For some users if i fetch weekly data i.e. if i fetch data for whole week at one time, it's giving me result but when I fetch data for single day in past, it's not giving me any result.
Below is my schema for one table. I have also attached my logic files that how are we configuring amplify. Can you please check and let us know why amplify is behaving like this way?
amplify-issue.zip
extension SleepSession2 {
// MARK: - CodingKeys
enum CodingKeys: String, ModelKey {
case id
case user_id
case sleep_start_time
case sleep_end_time
case sleep_data
case avg_heart_rate
case avg_temperature
case avg_breathing_rate
case avg_sp_o2
case avg_hrv
case health_score
case data_point_score
case sleep_jobid
case ring_serial_no
case sleep_window_start
case sleep_window_end
case owner
case createdAt
case updatedAt
}
static let keys = CodingKeys.self
// MARK: - ModelSchema
static let schema = defineSchema { model in
let sleepSession2 = SleepSession2.keys
model.authRules = [
rule(allow: .owner, ownerField: "owner", identityClaim: "cognito:username", provider: .userPools, operations: [.create, .update, .delete, .read])
]
model.listPluralName = "SleepSession2s"
model.syncPluralName = "SleepSession2s"
model.attributes(
.index(fields: ["user_id", "sleep_window_end"], name: nil),
.primaryKey(fields: [sleepSession2.user_id, sleepSession2.sleep_window_end])
)
model.fields(
.field(sleepSession2.id, is: .required, ofType: .string),
.field(sleepSession2.user_id, is: .required, ofType: .string),
.field(sleepSession2.sleep_start_time, is: .required, ofType: .dateTime),
.field(sleepSession2.sleep_end_time, is: .required, ofType: .dateTime),
.field(sleepSession2.sleep_data, is: .optional, ofType: .embeddedCollection(of: Int.self)),
.field(sleepSession2.avg_heart_rate, is: .optional, ofType: .double),
.field(sleepSession2.avg_temperature, is: .optional, ofType: .double),
.field(sleepSession2.avg_breathing_rate, is: .optional, ofType: .double),
.field(sleepSession2.avg_sp_o2, is: .optional, ofType: .double),
.field(sleepSession2.avg_hrv, is: .optional, ofType: .double),
.field(sleepSession2.health_score, is: .optional, ofType: .double),
.field(sleepSession2.data_point_score, is: .optional, ofType: .string),
.field(sleepSession2.sleep_jobid, is: .optional, ofType: .string),
.field(sleepSession2.ring_serial_no, is: .optional, ofType: .string),
.field(sleepSession2.sleep_window_start, is: .required, ofType: .dateTime),
.field(sleepSession2.sleep_window_end, is: .required, ofType: .dateTime),
.field(sleepSession2.owner, is: .optional, ofType: .string),
.field(sleepSession2.createdAt, is: .optional, isReadOnly: true, ofType: .dateTime),
.field(sleepSession2.updatedAt, is: .optional, isReadOnly: true, ofType: .dateTime)
)
}
}
Steps To Reproduce
It is reproducible for some users all the time.
Login with user.
Check the data for olders days
Datastore not giving any data though the data is present in dynamodb
Expected behavior
Amplify datastore should give us the data, if it present in dynamodb
Amplify Framework Version
2.33.6
Amplify Categories
DataStore
Dependency manager
Swift PM
Swift version
5.9.2
CLI version
12.11.1
Xcode version
15.0
Relevant log output
<details>
<summary>Log Messages</summary>
INSERT LOG MESSAGES HERE
Is this a regression?
Yes
Regression additional context
No response
Platforms
iOS
OS Version
iOS 17.0
Device
iPhone 13
Specific to simulators
No response
Additional context
No response