Skip to content

Commit

Permalink
fix spellling
Browse files Browse the repository at this point in the history
  • Loading branch information
unimegan59781 committed Apr 24, 2024
1 parent aaf47e7 commit 60af861
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 57 deletions.
4 changes: 2 additions & 2 deletions lib/pages/company/companyCreate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class CompanyCreateJobState extends State<CompanyCreateJob> {
static const List<String> selections = <String>[
'First Aid',
'Manual Handling',
'Medicication Administration',
'Medication Administration',
'Mental Health Training',
'Elderly Care Training',
'Child Care Training',
Expand Down Expand Up @@ -357,7 +357,7 @@ class CompanyCreateJobState extends State<CompanyCreateJob> {
const SizedBox(height: 20),
PushButton(
buttonSize: 55,
text: "Select Abilitys",
text: "Select Abilities",
onPress: () => abilitySelector(context, selections)),
const SizedBox(height: 20),
const DisplayText(
Expand Down
5 changes: 2 additions & 3 deletions lib/pages/company/companyJob.dart
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ class CompanyJobState extends State<CompanyJob> {
bool company = assignedData['company_job_complete'];
bool worker = assignedData['company_job_complete'];

if (company && worker || notComplete) {
if (company && worker || notComplete == true) {
dbhandler
.child("Risk Support Plans")
.orderByChild('job_id')
Expand Down Expand Up @@ -656,8 +656,7 @@ class CompanyJobState extends State<CompanyJob> {
});
},
onDoubleTap: () async {
profileViewer(context,
"AIhwMbH3ExbIWVzAITBTBk1GX813"); //job['workerId']);
profileViewer(context, job['workerId']);
},
child: Container(
margin: const EdgeInsets.all(5), // between items
Expand Down
109 changes: 62 additions & 47 deletions lib/pages/company/companyWorkerList.dart
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ class CompanyWorkerListState extends State<CompanyWorkerList> {
.orderByChild('worker_id')
.equalTo(workerId)
.onValue
.listen((event) {
.listen((event) async {
print(
'Snapshot: ${event.snapshot.value}'); // Print the entire snapshot
if (event.snapshot.value != null) {
Expand All @@ -220,61 +220,72 @@ class CompanyWorkerListState extends State<CompanyWorkerList> {
}
}
}
print("megan this is a sucess");
print("HERE MATCHED");
print(matchedWorkerList);

List<Tuple2<String, int>> fullyMatchedWorkerList = [];

for (String workerId in matchedWorkerList) {
dbhandler
.child('Ability')
.orderByChild('worker_id')
.equalTo(workerId)
.onValue
.listen((event) async {
print(
'HERE ABILITIES Snapshot: ${event.snapshot.value}');
if (event.snapshot.value != null) {
Map<dynamic, dynamic>? data =
event.snapshot.value as Map<dynamic, dynamic>?;
if (data != null) {
List<String> workerAbilities = [];
// Assuming there is only one entry, you can access it directly
var abilityKey = data.keys.first;
var abilityData = data[abilityKey];
abilityData.forEach((key, value) {
if (key != 'worker_id') {
workerAbilities.add(key);
print("HERE HERE WORKER ID: $workerId");
if (widget.abilityList.isEmpty) {
int jobCount = await workerJobCount(workerId);
fullyMatchedWorkerList.add(Tuple2(workerId, jobCount));
print("HERE in here");
print(fullyMatchedWorkerList);
} else {
dbhandler
.child('Ability')
.orderByChild('worker_id')
.equalTo(workerId)
.onValue
.listen((event) async {
print(
'HERE ABILITIES Snapshot: ${event.snapshot.value}');
if (event.snapshot.value != null) {
Map<dynamic, dynamic>? data =
event.snapshot.value as Map<dynamic, dynamic>?;
if (data != null) {
List<String> workerAbilities = [];
// Assuming there is only one entry, you can access it directly
var abilityKey = data.keys.first;
var abilityData = data[abilityKey];
abilityData.forEach((key, value) {
if (key != 'worker_id') {
workerAbilities.add(key);
}
});
print("HERE LIST: $workerAbilities");

// Check if all abilities are present
bool allAbilitiesPresent = true;
for (String ability in widget.abilityList) {
if (!workerAbilities.contains(ability)) {
allAbilitiesPresent = false;
break;
}
}
});
print("HERE LIST: $workerAbilities");

// Check if all abilities are present
bool allAbilitiesPresent = true;
for (String ability in widget.abilityList) {
if (!workerAbilities.contains(ability)) {
allAbilitiesPresent = false;
break;
}
}

if (allAbilitiesPresent) {
int jobCount = await workerJobCount(workerId);
fullyMatchedWorkerList
.add(Tuple2(workerId, jobCount));
if (allAbilitiesPresent) {
int jobCount = await workerJobCount(workerId);
fullyMatchedWorkerList
.add(Tuple2(workerId, jobCount));
}
}
}
}
// sort the list by job count
fullyMatchedWorkerList
.sort((a, b) => a.item2.compareTo(b.item2));
//print(fullyMatchedWorkerLis);
List<String> orderedWorkers = fullyMatchedWorkerList
.map((tuple) => tuple.item1)
.toList();
});
}
// sort the list by job count
fullyMatchedWorkerList
.sort((a, b) => a.item2.compareTo(b.item2));
//print(fullyMatchedWorkerLis);
List<String> orderedWorkers = fullyMatchedWorkerList
.map((tuple) => tuple.item1)
.toList();
setState(() {
getList(orderedWorkers);
print(orderedWorkers);
});
print("workers");
print(orderedWorkers);
}
});
}
Expand Down Expand Up @@ -306,7 +317,11 @@ class CompanyWorkerListState extends State<CompanyWorkerList> {
Map<dynamic, dynamic>? data =
event.snapshot.value as Map<dynamic, dynamic>?;
if (data != null) {
count = data.length;
data.forEach((key, value) {
if (value['worker_job_complete'] == false) {
count++;
}
});
}
}
});
Expand Down Expand Up @@ -366,7 +381,7 @@ class CompanyWorkerListState extends State<CompanyWorkerList> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
const DisplayText(
text: "List of Availiable Workers",
text: "List of Available Workers",
fontSize: 30,
colour: Colors.black),
const SizedBox(height: 10),
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/worker/workerAbility.dart
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class WorkerAbilityState extends State<WorkerAbility> {
static const List<String> selections = <String>[
'First Aid',
'Manual Handling',
'Medicication Administration',
'Medication Administration',
'Mental Health Training',
'Elderly Care Training',
'Child Care Training',
Expand Down
4 changes: 4 additions & 0 deletions lib/pages/worker/workerNav.dart
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class WorkerNavigationBarState extends State<WorkerNavigationBar> {
icon: Icon(Icons.check_box_outlined),
label: 'Preferences',
),
// BottomNavigationBarItem(
// icon: Icon(Icons.calendar_month_outlined),
// label: 'Availability',
// ),
BottomNavigationBarItem(
icon: Icon(Icons.verified_outlined),
label: 'Abilities',
Expand Down
8 changes: 4 additions & 4 deletions lib/pages/worker/workerSettings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ class WorkerSettingsState extends State<WorkerSettings> {
const SizedBox(height: 20),
PushButton(
buttonSize: 70,
text: "Change Expeience",
text: "Change Experience",
onPress: () => profileChanger(context, "Years of Experience",
"experience", experience.toString())),
const SizedBox(height: 20),
Expand All @@ -233,9 +233,9 @@ class WorkerSettingsState extends State<WorkerSettings> {
onPress: () => profileChanger(context, "About you summary",
"description", description)),
const SizedBox(height: 20),
// PushButton(
// buttonSize: 70, text: "Delete Account", onPress: () => null),
// const SizedBox(height: 20),
PushButton(
buttonSize: 70, text: "Delete Account", onPress: () => null),
const SizedBox(height: 20),
PushButton(
buttonSize: 70, text: "Sign Out", onPress: () => signOut()),
const SizedBox(height: 20),
Expand Down

0 comments on commit 60af861

Please sign in to comment.