Fixes bug in ExpireIncompleteSurveyResponses
Use a left outer join on userProfileData so that the workflow processes responses for users that have been deleted
This commit is contained in:
parent
c8542cc5d0
commit
e4b18757d8
3 changed files with 11 additions and 3 deletions
|
|
@ -28,6 +28,7 @@
|
|||
- fixed #11137: Customers see failed orders
|
||||
- fixed #11156: Syndicated Content doesn't show all headlines in feed
|
||||
- fixed #11138: RichEdit, upload image does not commit a version tag
|
||||
- fixed ExpireIncompleteSurveyResponses Workflow: process responses for deleted users
|
||||
|
||||
7.8.1
|
||||
- mark $session->datetime->time as deprecated and remove its use from core code
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ Factored out into a separate subroutine for the sake of testability.
|
|||
|
||||
sub getSql {
|
||||
|
||||
# Use a left outer join on userProfileData so that we still get back responses for users that have been deleted
|
||||
return <<END_SQL;
|
||||
select
|
||||
r.Survey_responseId, r.username, r.userId, r.startDate,
|
||||
|
|
@ -166,7 +167,7 @@ select
|
|||
s.timeLimit, s.doAfterTimeLimit,
|
||||
ad.title, ad.url
|
||||
from
|
||||
Survey_response r, Survey s, assetData ad, userProfileData upd
|
||||
Survey_response r left outer join userProfileData upd on r.userId = upd.userId, Survey s, assetData ad
|
||||
where
|
||||
r.isComplete = 0
|
||||
and s.timeLimit > 0
|
||||
|
|
@ -175,7 +176,6 @@ where
|
|||
and ad.assetId = s.assetId
|
||||
and ad.revisionDate = s.revisionDate
|
||||
and s.revisionDate = r.revisionDate
|
||||
and upd.userId = r.userId
|
||||
END_SQL
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ my $session = WebGUI::Test->session;
|
|||
|
||||
#----------------------------------------------------------------------------
|
||||
# Tests
|
||||
plan tests => 25;
|
||||
plan tests => 26;
|
||||
|
||||
use_ok('WebGUI::Workflow::Activity::ExpireIncompleteSurveyResponses');
|
||||
|
||||
|
|
@ -127,6 +127,13 @@ $session->db->write('update Survey_response set endDate = 0, isComplete = 0 wher
|
|||
# Make sure SQL only returns 1 incomplete response
|
||||
is( scalar $session->db->buildArray($SQL), 1, 'Make sure SQL only returns 1 incomplete response');
|
||||
|
||||
##
|
||||
# Make sure workflow handles responses for deleted users
|
||||
#
|
||||
$session->db->write('update Survey_response set userId = ? where Survey_responseId = ?', ['not-a-user-id', $responseId]);
|
||||
is( scalar $session->db->buildArray($SQL), 1, 'Still returns 1 row, even though user does not exist (sql left outer join)');
|
||||
$session->db->write('update Survey_response set userId = ? where Survey_responseId = ?', [$user->getId, $responseId]);
|
||||
|
||||
##
|
||||
# Delete Expired
|
||||
##
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue