Skip to content

Commit

Permalink
Merge branch 'develop' into HCMPRE-1873-GITHUB-ACTIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
Shashwat12-egov authored Jan 30, 2025
2 parents bb65a8f + 8dc8913 commit 1cb4591
Show file tree
Hide file tree
Showing 63 changed files with 2,250 additions and 1,268 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/flutter-build-apk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,29 @@ jobs:
env:
BUILD_CONFIG: release # or profile depending on your choice
run: |
echo "Current working directory: $(pwd)"
bash ./tools/generate-apk.sh
echo "Current working directory: $(pwd)"
echo "Listing all files at the current level:"
ls -l
# Step 8: Verify APK path and upload artifacts
- name: Check APK existence
run: |
echo "Looking for APK file"
if [ -f apps/health_campaign_field_worker_app/build/app/outputs/flutter-apk/app-release.apk ]; then
if [ -f apps/health_campaign_field_worker_app/build/app/outputs/apk/release/app-release.apk ]; then
echo "APK found."
else
echo "APK not found in the expected path."
find . -name "app-release.apk"
exit 1
fi
# Archive the APK as a build artifact so it can be downloaded
- name: Upload APKs
uses: actions/upload-artifact@v3
with:
name: app-release-apk
path: apps/health_campaign_field_worker_app/build/app/outputs/flutter-apk/app-release.apk
path: apps/health_campaign_field_worker_app/build/app/outputs/apk/release/app-release.apk

- name: Upload .env as artifact
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion apps/health_campaign_field_worker_app/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ class MainApplicationState extends State<MainApplication>
location: BannerLocation.topEnd,
color: () {
switch (envConfig.variables.envType) {
case EnvType.uat:
case EnvType.uat || EnvType.demo:
return Colors.green;
case EnvType.qa:
return Colors.pink;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'dart:async';
import 'dart:core';

import 'package:attendance_management/attendance_management.dart';
import 'package:survey_form/survey_form.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:digit_components/digit_components.dart';
import 'package:digit_data_model/data_model.dart';
Expand All @@ -14,6 +13,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:inventory_management/inventory_management.dart';
import 'package:isar/isar.dart';
import 'package:recase/recase.dart';
import 'package:survey_form/survey_form.dart';

import '../../../models/app_config/app_config_model.dart' as app_configuration;
import '../../data/local_store/no_sql/schema/app_configuration.dart';
Expand Down Expand Up @@ -219,56 +219,6 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {

List<ProjectModel> staffProjects;
try {
if (context.loggedInUserRoles
.where(
(role) => role.code == RolesType.districtSupervisor.toValue(),
)
.toList()
.isNotEmpty) {
final individual = await individualRemoteRepository.search(
IndividualSearchModel(
userUuid: [projectStaff.userId.toString()],
),
);
if (individual.isNotEmpty) {
final attendanceRegisters = await attendanceRemoteRepository.search(
AttendanceRegisterSearchModel(
staffId: individual.first.id,
referenceId: projectStaff.projectId,
),
);
await attendanceLocalRepository.bulkCreate(attendanceRegisters);

for (final register in attendanceRegisters) {
if (register.attendees != null &&
(register.attendees ?? []).isNotEmpty) {
try {
final individuals = await individualRemoteRepository.search(
IndividualSearchModel(
id: register.attendees!
.map((e) => e.individualId!)
.toList(),
),
);
await individualLocalRepository.bulkCreate(individuals);
final logs = await attendanceLogRemoteRepository.search(
AttendanceLogSearchModel(
registerId: register.id,
),
);
await attendanceLogLocalRepository.bulkCreate(logs);
} catch (_) {
emit(state.copyWith(
loading: false,
syncError: ProjectSyncErrorType.project,
));

return;
}
}
}
}
}
staffProjects = await projectRemoteRepository.search(
ProjectSearchModel(
id: projectStaff.projectId,
Expand Down Expand Up @@ -453,6 +403,50 @@ class ProjectBloc extends Bloc<ProjectEvent, ProjectState> {

List<BoundaryModel> boundaries;
try {
if (context.loggedInUserRoles
.where(
(role) =>
role.code == RolesType.districtSupervisor.toValue() ||
role.code == RolesType.teamSupervisor.toValue(),
)
.toList()
.isNotEmpty) {
final attendanceRegisters = await attendanceRemoteRepository.search(
AttendanceRegisterSearchModel(
staffId: context.loggedInIndividualId,
referenceId: event.model.id,
localityCode: event.model.address?.boundary,
),
);
await attendanceLocalRepository.bulkCreate(attendanceRegisters);

for (final register in attendanceRegisters) {
if (register.attendees != null &&
(register.attendees ?? []).isNotEmpty) {
try {
final individuals = await individualRemoteRepository.search(
IndividualSearchModel(
id: register.attendees!.map((e) => e.individualId!).toList(),
),
);
await individualLocalRepository.bulkCreate(individuals);
final logs = await attendanceLogRemoteRepository.search(
AttendanceLogSearchModel(
registerId: register.id,
),
);
await attendanceLogLocalRepository.bulkCreate(logs);
} catch (_) {
emit(state.copyWith(
loading: false,
syncError: ProjectSyncErrorType.project,
));

return;
}
}
}
}
try {
final startDate = DateTime(
DateTime.now().year, DateTime.now().month, DateTime.now().day)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ import 'package:dart_mappable/dart_mappable.dart';
export 'entities/additional_fields_type.dart';
export 'entities/roles.dart';
export 'entities/roles_type.dart';
export 'entities/status.dart';
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import 'entities/mdms_module_enums.dart' as p3;
import 'entities/roles.dart' as p4;
import 'entities/roles_type.dart' as p5;
import 'entities/scanner_type.dart' as p6;
import 'entities/status.dart' as p7;

void initializeMappers() {
p0.DownsyncSearchModelMapper.ensureInitialized();
Expand All @@ -22,5 +21,4 @@ void initializeMappers() {
p4.RolesMapper.ensureInitialized();
p5.RolesTypeMapper.ensureInitialized();
p6.ScannerTypeMapper.ensureInitialized();
p7.StatusMapper.ensureInitialized();
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,23 @@
import 'package:dart_mappable/dart_mappable.dart';

part 'roles_type.mapper.dart';

@MappableEnum(caseStyle: CaseStyle.upperCase)
enum RolesType {
@MappableValue("WAREHOUSE_MANAGER") warehouseManager,
@MappableValue("DISTRIBUTOR") distributor,
@MappableValue("HEALTH_FACILITY_WORKER") healthFacilityWorker,
@MappableValue("DISTRICT_SUPERVISOR") districtSupervisor,
@MappableValue("FIELD_SUPERVISOR") fieldSupervisor,
@MappableValue("SUPERUSER") superuser,
@MappableValue("REGISTRAR") registrar,
;
}
@MappableValue("WAREHOUSE_MANAGER")
warehouseManager,
@MappableValue("DISTRIBUTOR")
distributor,
@MappableValue("HEALTH_FACILITY_WORKER")
healthFacilityWorker,
@MappableValue("DISTRICT_SUPERVISOR")
districtSupervisor,
@MappableValue("FIELD_SUPERVISOR")
fieldSupervisor,
@MappableValue("SUPERUSER")
superuser,
@MappableValue("REGISTRAR")
registrar,
@MappableValue("TEAM_SUPERVISOR")
teamSupervisor,
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class RolesTypeMapper extends EnumMapper<RolesType> {
return RolesType.superuser;
case "REGISTRAR":
return RolesType.registrar;
case "TEAM_SUPERVISOR":
return RolesType.teamSupervisor;
default:
throw MapperException.unknownEnumValue(value);
}
Expand All @@ -61,6 +63,8 @@ class RolesTypeMapper extends EnumMapper<RolesType> {
return "SUPERUSER";
case RolesType.registrar:
return "REGISTRAR";
case RolesType.teamSupervisor:
return "TEAM_SUPERVISOR";
}
}
}
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
{
"name": "Registrar",
"value": "REGISTRAR"
},
{
"name": "Team Supervisor",
"value": "TEAM_SUPERVISOR"
}
],
"isEnum": true
Expand Down
Loading

0 comments on commit 1cb4591

Please sign in to comment.