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

PersonalSiteReportHours Page: Some Jobs May Not Be Displayed if More than 999 Active Jobs #485

Open
jesslopez-sf opened this issue Mar 9, 2020 · 2 comments

Comments

@jesslopez-sf
Copy link

jesslopez-sf commented Mar 9, 2020

When customer orgs have more than 999 active Volunteer Jobs, it is possible that some volunteers' Jobs will not display on the Report Hours Personal Site Page.

This is because we cap Volunteer Jobs at 999 in this SOQL query:


SELECT Name, Id, 
    (SELECT Id, GW_Volunteers__Contact__c 
    FROM GW_Volunteers__Volunteer_Hours__r 
    WHERE GW_Volunteers__Contact__c = '003xxxxxxxxxxxx' LIMIT 1) 
FROM GW_Volunteers__Volunteer_Job__c 
WHERE (GW_Volunteers__Campaign__r.IsActive = TRUE 
    AND GW_Volunteers__Inactive__c = FALSE) 
ORDER BY name ASC NULLS FIRST
LIMIT 999

It only returns 999 Volunteer Jobs and then only adds those Volunteer Jobs where the Contact is the Id of the Contact passed in to the drop-down menu. I ran the query in the Dev Console’s Query Editor and confirmed that only 5 of the jobs returned were associated with the Contact in the customer org. When I changed the limit to 20000, on the other hand, more Jobs associated with that Contact were returned.

This is happening in VOL_CTRL_VolunteersReportHours.cls, lines 171-178. We then add the matching jobs for that Contact in lines 185-193.

Steps to Repeat in Scratch Org:

  • Create Contact (First Name = ‘Test’; Last Name = ‘Test’; Email = YOUR_EMAIL_ADDRESS);
  • Create 2000 Volunteer Campaigns in Dev Console → Execute Anonymous:
 // I ran this 8 times because the Trigger that creates Campaign Statuses was eating up DML rows.
    
    List<Campaign> volCampaigns = new List<Campaign>();
    for(Integer x = 0; x < 2000; x++)
    {
        volCampaigns.add(new Campaign(
            Name = 'Campaign ' + x,
            IsActive = true
        ));
    }
    insert volCampaigns;
  • Create Volunteer Jobs in Execute Anonymous
List<Campaign> campList = [SELECT Id FROM Campaign];
    List<Volunteer_Job__c> jobsList = new List<Volunteer_Job__c>();
    
    for(Integer x = 0; x < campList.size(); x++)
    {
        jobsList.add(new Volunteer_Job__c(
            Name = 'Vol Job ' + x,
            Campaign__c = campList[x].Id,
            Display_on_Website__c = true
        ));
    }
    
    insert jobsList;
  • Add Volunteer Hours for a handful of jobs and relate to the Contact, for example all Contacts where the Campaign Name is Campaign 249.

    • Status = Prospect
    • Start Date = past date
  • Go to Personal Site page and click Report Hours tab.

  • Expected Behavior: you see all of that Volunteer’s relevant Jobs in the Volunteer Job list.
    Actual: you may not see all of them depending on whether or not the job was cut off from the query results.

@jesslopez-sf
Copy link
Author

**lurch: add

@LurchTheButler
Copy link

Tracking W-040031

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants