10 tests for rank swap, promote and demote
changed promote and demote to use placeholders in AssetLineage. Added explicit return values to demote
This commit is contained in:
parent
c9e2a8b9f3
commit
a7cb2133c9
2 changed files with 67 additions and 5 deletions
|
|
@ -139,12 +139,13 @@ Swaps lineage with sister below. Returns 1 if there is a sister to swap. Otherwi
|
|||
sub demote {
|
||||
my $self = shift;
|
||||
my ($sisterLineage) = $self->session->db->quickArray("select min(lineage) from asset
|
||||
where parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and state='published' and lineage>".$self->session->db->quote($self->get("lineage")));
|
||||
where parentId=? and state='published' and lineage>?",[$self->get('parentId'), $self->get('lineage')]);
|
||||
if (defined $sisterLineage) {
|
||||
$self->swapRank($sisterLineage);
|
||||
$self->{_properties}{lineage} = $sisterLineage;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -634,8 +635,7 @@ Keeps the same rank of lineage, swaps with sister above. Returns 1 if there is a
|
|||
sub promote {
|
||||
my $self = shift;
|
||||
my ($sisterLineage) = $self->session->db->quickArray("select max(lineage) from asset
|
||||
where parentId=".$self->session->db->quote($self->get("parentId"))."
|
||||
and state='published' and lineage<".$self->session->db->quote($self->get("lineage")));
|
||||
where parentId=? and state='published' and lineage<?",[$self->get("parentId"), $self->get("lineage")]);
|
||||
if (defined $sisterLineage) {
|
||||
$self->swapRank($sisterLineage);
|
||||
$self->{_properties}{lineage} = $sisterLineage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue