Skip to content

Commit

Permalink
Merge pull request #2343 from drgrice1/bugfix/ambibuous-set-id
Browse files Browse the repository at this point in the history
Fix a potentially ambiguous column in SQL order by clauses.
  • Loading branch information
Alex-Jordan authored Feb 29, 2024
2 parents 65a1b74 + eb7b9bf commit b3ec23e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/WeBWorK/ContentGenerator/Instructor/UserDetail.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ WeBWorK::ContentGenerator::Instructor::UserDetail - Detailed User specific infor

use WeBWorK::Utils qw(x);
use WeBWorK::Utils::Instructor qw(assignSetToUser);
use WeBWorK::DB::Utils qw(grok_versionID_from_vsetID_sql);
use WeBWorK::Debug;

# We use the x function to mark strings for localizaton
Expand Down Expand Up @@ -158,7 +159,7 @@ sub initialize ($c) {
$c->{mergedVersions}{$setID} = [
$db->getMergedSetVersionsWhere(
{ user_id => $editForUserID, set_id => { like => "$setID,v\%" } },
\q{(SUBSTRING(set_id,INSTR(set_id,',v')+2)+0)}
\grok_versionID_from_vsetID_sql($db->{set_version_merged}->sql->_quote('set_id'))
)
];
}
Expand Down
8 changes: 5 additions & 3 deletions lib/WeBWorK/ContentGenerator/ProblemSet.pm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ problem set.
use WeBWorK::Debug;
use WeBWorK::Utils qw(path_is_subdir is_restricted wwRound before between after grade_set format_set_name_display);
use WeBWorK::Utils::Rendering qw(renderPG);
use WeBWorK::DB::Utils qw(grok_versionID_from_vsetID_sql);
use WeBWorK::Localize;

async sub initialize ($c) {
Expand Down Expand Up @@ -195,9 +196,10 @@ sub gateway_body ($c) {
my $timeInterval = $set->time_interval || 0;
my @versionData;

my @setVersions =
$db->getMergedSetVersionsWhere({ user_id => $effectiveUser, set_id => { like => $set->set_id . ',v%' } },
\q{(SUBSTRING(set_id,INSTR(set_id,',v')+2)+0)});
my @setVersions = $db->getMergedSetVersionsWhere(
{ user_id => $effectiveUser, set_id => { like => $set->set_id . ',v%' } },
\grok_versionID_from_vsetID_sql($db->{set_version_merged}->sql->_quote('set_id'))
);

for my $verSet (@setVersions) {
# Count number of versions in current timeInterval
Expand Down

0 comments on commit b3ec23e

Please sign in to comment.