ensure uniqueness of suggested priority values, patch by rmyers

This commit is contained in:
Mike Bonnet 2007-06-05 01:28:35 -04:00
parent b1a7b52e4e
commit 949ef37063
2 changed files with 6 additions and 2 deletions

View file

@ -756,7 +756,11 @@ def tagparent(req, tagID, parentID, action):
values['parent'] = parent
inheritanceData = server.getInheritanceData(tag['id'])
values['numParents'] = len(inheritanceData)
maxPriority = 0
for datum in inheritanceData:
if datum['priority'] > maxPriority:
maxPriority = datum['priority']
values['maxPriority'] = maxPriority
inheritanceData = [datum for datum in inheritanceData \
if datum['parent_id'] == parent['id']]
if len(inheritanceData) == 0:

View file

@ -28,7 +28,7 @@
<tr>
<th>Priority</th>
<td>
<input type="text" name="priority" value="#if $inheritanceData then $inheritanceData.priority else $numParents#"/>
<input type="text" name="priority" value="#if $inheritanceData then $inheritanceData.priority else $maxPriority + 1#"/>
</td>
</tr>
<tr>