Issue Details (XML | Word | Printable)

Key: FLM-294
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Adam Zieliński
Reporter: Adam Zieliński
Votes: 0
Watchers: 0
Operations

Clone this issue
Create sub-task
If you were logged in you would be able to see more operations.
Filmaster

Add number_of_comments colum in core_object

Created: 22/Feb/10 11:21 AM   Updated: 08/Mar/10 11:16 AM
Component/s: Core
Affects Version/s: 1.0.2
Fix Version/s: 1.0.2

Time Tracking:
Not Specified

Issue Links:
Similar
 


 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Borys Musielak added a comment - 22/Feb/10 11:50 AM
The number of comments should be updated when adding new comment or deleting comment straight in ThreadedComment's model class, to make sure it's always in sync with the actual number of comments.


Adam Zieliński added a comment - 28/Feb/10 11:28 PM
done

Borys Musielak added a comment - 01/Mar/10 02:01 PM
I think you linked to a wrong changeset - the one linked is a merge.

BTW, are we already using this comments field anywhere?
And is it being updated every time a new comment is added / removed?

A link to the code would be useful.

Adam Zieliński added a comment - 01/Mar/10 03:49 PM
Sorry this link is proper http://bitbucket.org/filmaster/filmaster-test/changeset/8d62afa6ea6e/ Yes we are using this filed activities templates at dev server. As you can see in the link above I've overwritten save and delete methods to update number_of_comments. The only problem was in default delete action in admin interface because it doesn't use overwritten delete method from model so I've to write new one.

Borys Musielak added a comment - 01/Mar/10 04:59 PM
Cool. Very nice.

Please write a simple test for this that:
1. Creates a blog post,
2. Adds a few comments
3. Then checks that the number_of_comments fields is equal to the number of comments.
4. Then deletes one of the comments
5. Then checks the number_of_comments again.

You can use test_watching.py as a template.


Borys Musielak added a comment - 01/Mar/10 05:05 PM
Also, remove the prints like
print "NUM OF COM BEFORE " + str(self.content_object.number_of_comments)
from film20/threadedcomments/models.py
- they may cause problems on apache