Closed vkprogrammer-001 closed 5 months ago
@Akshatji800 can you please review this
Fixes #192
Issue Description: When using the
.subtract(Duration(hours: 1))
method to calculate thescheduledDate
, an error occurs: "Exception: Invalid argument (scheduledDate): Must be a date in the future: Instance of 'TZDateTime'." The issue arises because the adjustedscheduledDate
is not in the future.Root Cause: The subtraction of one hour from the original
scheduledDate
results in a value that is not ahead of the current time.Proposed Solution: To resolve this issue, we can modify the code to ensure that the
scheduledDate
is always in the future. Instead of subtracting an hour, we can directly use the originalscheduledDate
.Updated Code:
scheduledDate = await tz.TZDateTime.from( DateTime.fromMillisecondsSinceEpoch(beacon.startsAt!), tz.local, );
By removing the
.subtract(Duration(hours: 1))
part, we avoid the error and ensure that thescheduledDate
remains in the future.
Hmm but what is the actual use case. When shall it be scheduled? What shall the notification show?
@Akshatji800 The issue labeled #192 requires a solution to address the problem. I am providing an answer that resolves your query. Here is my response.
Use Case: Group Travel and Hiking Coordination
Scenario: Group Travel
Scenario: Hiking Expeditions
Customizable Features:
Notification Content:
In summary, the Beacon project ensures seamless communication, safety, and navigation for group travelers and hikers. By following the beacon, lost members can quickly find their way back to the group, enhancing the overall journey. 🌟
@vkprogrammer-001 , we're currently subtracting one hour to schedule the second notification. However, it's crucial to check if the scheduled time is after the current time before proceeding with scheduling. If the scheduled time is after the current time, we'll proceed with the scheduling. Please review this logic again.
Fixes #192
Issue Description: When using the
.subtract(Duration(hours: 1))
method to calculate thescheduledDate
, an error occurs: "Exception: Invalid argument (scheduledDate): Must be a date in the future: Instance of 'TZDateTime'." The issue arises because the adjustedscheduledDate
is not in the future.Root Cause: The subtraction of one hour from the original
scheduledDate
results in a value that is not ahead of the current time.Proposed Solution: To resolve this issue, I have modified the code to ensure that the
scheduledDate
is always in the future. Instead of subtracting an hour, we can directly use the originalscheduledDate
.Updated Code:
By removing the
.subtract(Duration(hours: 1))
part, we avoid the error and ensure that thescheduledDate
remains in the future.