Skip to content

Commit

Permalink
Fixed next to register for add question btn when no more pages present
Browse files Browse the repository at this point in the history
  • Loading branch information
tcdahlberg committed Jan 11, 2024
1 parent 6952f83 commit 3ad5601
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public with sharing class SummitEventsAdditionalQuestionsCtlr {
public List<questionItem> questionWrapper { get; set; }
private Id incomingRegId { get; set; }
public Map<String, String> lookUpDisplayValue { get; set; }

public String nextUrl { get; set; }

public class questionItem {
public String questionId { get; set; }
Expand Down Expand Up @@ -85,6 +85,7 @@ public with sharing class SummitEventsAdditionalQuestionsCtlr {

templateSelected = SummitEventsShared.getTemplate(eventPage.Template__c);
pageFlow = SummitEventsShared.getPageFlow(eventInformation.eventId, eventInstance.Instance_Title__c, ApexPages.currentPage(), eventInstance.Instance_Start_Date__c, eventInstance.Instance_End_Date__c);
nextUrl = pageFlow.get('Next').getUrl().toLowerCase();
formattedNavDate = SummitEventsShared.navBreadcrumbBuilder(eventInstance);
instanceName = eventInstance.Name;
startTimeString = SummitEventsShared.formatTime(eventInstance.Instance_Start_Time__c, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@
</apex:repeat>
<div class="slds-col slds-size_1-of-1 slds-clearfix slds-p-around_x-small slds-p-vertical_xx-small">
<p class="slds-text-body slds-p-vertical_xx-small">
<apex:commandButton action="{!submitAdditionalQuestions}" onClick="fadeout();" Value="Next" id="submitQuestions" styleClass="slds-button slds-button_brand slds-p-horizontal_xx-large slds-p-vertical_xx-small"/>
<apex:commandButton action="{!submitAdditionalQuestions}" onClick="fadeout();" Value="{!IF(CONTAINS(nextUrl,'summiteventsconfirmation'), 'Register', 'Next')}" id="submitQuestions" styleClass="slds-button slds-button_brand slds-p-horizontal_xx-large slds-p-vertical_xx-small"/>
<apex:commandLink action="{!previousPage}" onClick="fadeout();" Value="Previous" id="previousPage" styleClass="slds-button slds-button_neutral slds-p-horizontal_xx-large slds-p-vertical_xx-small" immediate="true"/>
</p>
</div>
Expand Down
45 changes: 45 additions & 0 deletions force-app/test/default/classes/SummitEventsRegistration_TEST.cls
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,49 @@ public class SummitEventsRegistration_TEST {
System.assertEquals(emailTasks.size(), 2);
Test.stopTest();
}

@IsTest
public static void TestSummitEventsMultiRegistration() {

List<Summit_Events_Instance__c> seaTestInstances = SummitEventsTestSharedDataFactory.createTestEvent();

List<Summit_Events_Registration__c> seaRegistrations = new List<Summit_Events_Registration__c>();

for (Integer x = 0; x < 5; x++) {
Summit_Events_Registration__c seaTestRegistration = SummitEventsTestSharedDataFactory.createEventRegistration(seaTestInstances[1], 'Test' + x, 'Tester' + x, 'test+' + x + '@test.net', '55555', '1971-03-22', '2012', null);
seaRegistrations.add(seaTestRegistration);
}

Summit_Events__c seaTestEvent = SummitEventsTestSharedDataFactory.getEventRecord(seaTestInstances[1].Event__c);

Summit_Events_Email__c email1 = new Summit_Events_Email__c();
email1.Event__c = seaTestInstances[1].Event__c;
email1.Action_Status__c = 'Registered';
email1.Email_Content__c = 'Sample text here';
email1.Letterhead_HTML__c = 'Letterhead goes here<br/>[[DONT_DELETE_CONTENT_HERE]]';
email1.BCC_Email__c = '[email protected]';
insert email1;

Test.startTest();
List<Id> contactIds = new List<Id>();
List<Id> registrationIds = new List<Id>();
for (Summit_Events_Registration__c seaRegistration : seaRegistrations) {
seaRegistration.Status__c = 'Registered';
contactIds.add(seaRegistration.Contact__c);
registrationIds.add(seaRegistration.Id);
}
update seaRegistrations;

List<Task> emailTasks = [
SELECT Id, Subject, Description
FROM Task
WHERE WhatId IN :registrationIds
AND Type = 'Email'
AND Status = 'Completed'
AND Priority = 'Low'
AND WhoId IN :contactIds
];
System.assertEquals(emailTasks.size(), 5);
Test.stopTest();
}
}

0 comments on commit 3ad5601

Please sign in to comment.