Skip to content

Commit

Permalink
Fix next month leaves are not showing in calendar (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sneha-s authored Feb 2, 2024
1 parent 079376a commit c97cd20
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 19 deletions.
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '11.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -476,7 +476,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -525,7 +525,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
2 changes: 1 addition & 1 deletion lib/data/repo/leave_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class LeaveRepo {
(leavesByStartDate, leavesByEndDate) {
List<Leave> mergedList = leavesByStartDate;
mergedList.addAll(leavesByEndDate.where((endDateLeave) =>
!leavesByEndDate.any((startDateLeave) =>
!leavesByStartDate.any((startDateLeave) =>
startDateLeave.leaveId == endDateLeave.leaveId)));
return mergedList;
},
Expand Down
31 changes: 18 additions & 13 deletions lib/data/services/leave_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -67,19 +67,24 @@ class LeaveService {
.map((event) => event.docs.map((leave) => leave.data()).toList());

Stream<List<Leave>> monthlyLeaveByEndDate(
{required int year, required int month, required String spaceId}) =>
_leaveDb(spaceId: spaceId)
.where(FireStoreConst.leaveStatus,
isEqualTo: LeaveStatus.approved.value)
.where(FireStoreConst.endLeaveDate,
isGreaterThanOrEqualTo: DateTime(year, month).timeStampToInt)
.where(FireStoreConst.endLeaveDate,
isLessThan: DateTime(year, month + 1).timeStampToInt)
.snapshots()
.asyncMap((event) => event.docs
.map((leave) => leave.data())
.where((leave) => leave.startDate.isBefore(DateTime(year, month)))
.toList());
{required int year, required int month, required String spaceId}) {
final leaves = _leaveDb(spaceId: spaceId)
.where(FireStoreConst.leaveStatus,
isEqualTo: LeaveStatus.approved.value)
.where(FireStoreConst.endLeaveDate,
isLessThan: DateTime(year, month + 1).timeStampToInt)
.where(FireStoreConst.endLeaveDate,
isGreaterThanOrEqualTo: DateTime(year, month).timeStampToInt)
.snapshots()
.asyncMap((event) => event.docs
.map((leave) {
return leave.data();
})
.where((leave) => leave.startDate.isBefore(DateTime(year, month)))
.toList());

return leaves;
}

Stream<List<Leave>> userLeaveByStatus(
{required String uid,
Expand Down

0 comments on commit c97cd20

Please sign in to comment.