Changeset 80a8145


Ignore:
Timestamp:
Feb 26, 2012, 4:22:21 PM (14 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage
Children:
014f227, 65c0a28
Parents:
4091199
git-author:
Alex Dehnert <adehnert@…> (02/26/12 16:18:33)
git-committer:
Alex Dehnert <adehnert@…> (02/26/12 16:22:21)
Message:

Fix new groups in groups/diffs.py (Trac: #67)

This is three related fixes.

The Trac issue is that it turns out Django doesn't like negative queryset
indexes, so do a .reverse() and then a positive index...

The second issue is that, even if the negative indexed worked, we wanted to
be updating before, not after --- we want to set the original we're diffing
against, not the current version, despite the fact that we're grabbing the
original from after_versions instead of before_versions.

Finally, the third issue is that the comment about the no-change case is
misleading --- even when a group is just recognized, it still will have
multiple versions. In particular, the startup form submission + the approval.
This adds a clarifying comment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/groups/diffs.py

    r4091199 r80a8145  
    224224                # New group that's been edited since. Diff against the creation
    225225                # (since creation sent mail, but later changes haven't)
    226                 after = after_versions[-1]
     226                before = after_versions.reverse()[0]
    227227                stats['change_new'] += 1
    228228            stats['change_total'] += 1
     
    238238        else:
    239239            # New group that's only been edited once
     240            # Note that "normal" new groups will have their startup form
     241            # (which creates the Group object) and the approval (which makes
     242            # more changes, so this is group startups + NGEs, not actually
     243            # normal new groups)
    240244            stats['new_group'] += 1
    241245
Note: See TracChangeset for help on using the changeset viewer.