Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optimize ProcessListVRS to reuse existing Hours if possible. Issue #154 #223

Merged
merged 10 commits into from
Dec 5, 2016
Prev Previous commit
Next Next commit
test changes due to new behavior of updating status on matched hours
  • Loading branch information
David Habib committed Nov 30, 2016
commit 38587899c06c05f7bc4d755d2af6678cfed12b97
11 changes: 4 additions & 7 deletions src/classes/VOL_VRS_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public with sharing class VOL_VRS_TEST {
Test.stopTest();

list<Volunteer_Shift__c> listShift = [select Id, Name, Volunteer_Job__r.Name from Volunteer_Shift__c where Job_Recurrence_Schedule__c = :jrs.Id];
//system.debug(listShift);
system.assertEquals(6, listShift.size());

list<Volunteer_Hours__c> listHours = [select Id, Status__c, Number_of_Volunteers__c, Comments__c
Expand All @@ -171,24 +170,22 @@ public with sharing class VOL_VRS_TEST {
system.assertEquals(vrs.Comments__c, listHours[0].Comments__c);

listHours[0].Status__c = 'No-Show';
//system.debug('****DJH updating hr: '+ listHours[0]);
update listHours[0];

vrs.Days_of_Week__c = 'Monday;Friday';
vrs.Volunteer_Hours_Status__c = 'Confirmed';
update vrs;

listHours = [select Id, Status__c, Planned_Start_Date_Time__c from Volunteer_Hours__c where Volunteer_Recurrence_Schedule__c = :vrs.Id order by Planned_Start_Date_Time__c];
//system.debug('****DJH listHours: ' + listHours);

listHours = [select Id, Status__c from Volunteer_Hours__c where Status__c = 'My Custom Status' and Volunteer_Recurrence_Schedule__c = :vrs.Id];
system.assertEquals(1, listHours.size()); // first Monday was changed to no-show
system.assertEquals(0, listHours.size());

listHours = [select Id, Status__c from Volunteer_Hours__c where Status__c = 'No-Show' and Volunteer_Recurrence_Schedule__c = :vrs.Id];
system.assertEquals(1, listHours.size());

listHours = [select Id, Status__c from Volunteer_Hours__c where Status__c = 'Confirmed' and Volunteer_Recurrence_Schedule__c = :vrs.Id];
system.assertEquals(2, listHours.size());
system.assertEquals(3, listHours.size());
}

//******************************************************************************************************
Expand Down Expand Up @@ -248,13 +245,13 @@ public with sharing class VOL_VRS_TEST {
system.assertEquals(4, listHours.size());

listHours = [select Id, Status__c from Volunteer_Hours__c where Status__c = 'My Custom Status'];
system.assertEquals(1, listHours.size());
system.assertEquals(0, listHours.size());

listHours = [select Id, Status__c from Volunteer_Hours__c where Status__c = 'Completed'];
system.assertEquals(1, listHours.size());

listHours = [select Id, Status__c from Volunteer_Hours__c where Status__c = 'Confirmed'];
system.assertEquals(2, listHours.size());
system.assertEquals(3, listHours.size());
}

//******************************************************************************************************
Expand Down