• 
      

    Changed model for Trophy

    Review Request #3872 — Created Feb. 14, 2013 and discarded

    Information

    Review Board
    master

    Reviewers

    Changed model for Trophy
    
    Added Trophy model at reviewboard/accounts/models.py.
    
     
    Description From Last Updated

    Col: 1 E302 expected 2 blank lines, found 1

    reviewbot reviewbot

    Col: 80 E501 line too long (101 > 79 characters)

    reviewbot reviewbot

    Col: 5 E128 continuation line under-indented for visual indent

    reviewbot reviewbot

    David and I discussed this design a bit more, and want to make a change here. A ManyToManyField here would …

    chipx86 chipx86

    256 is a bit long. 16 bytes should be more than enough. We should define each type of trophy we …

    chipx86 chipx86

    'received'. Note the order of 'i' and 'e'. I would just call it 'timestamp' though. Also it should default to …

    chipx86 chipx86
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/accounts/models.py
        Ignored Files:
      
      
    2. reviewboard/accounts/models.py (Diff revision 1)
       
       
      Show all issues
      Col: 1
       E302 expected 2 blank lines, found 1
      
    3. 
        
    HI
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/accounts/evolutions/__init__.py
          reviewboard/accounts/models.py
          reviewboard/accounts/evolutions/trophies.py
        Ignored Files:
      
      
    2. Show all issues
      Col: 80
       E501 line too long (101 > 79 characters)
      
    3. 
        
    HI
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/accounts/evolutions/__init__.py
          reviewboard/accounts/models.py
          reviewboard/accounts/evolutions/trophies.py
        Ignored Files:
      
      
    2. Show all issues
      Col: 5
       E128 continuation line under-indented for visual indent
      
    3. 
        
    HI
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/accounts/evolutions/__init__.py
          reviewboard/accounts/models.py
          reviewboard/accounts/evolutions/trophies.py
        Ignored Files:
      
      
    2. 
        
    HI
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/accounts/evolutions/__init__.py
          reviewboard/accounts/models.py
          reviewboard/accounts/evolutions/trophies.py
        Ignored Files:
      
      
    2. 
        
    chipx86
    1. 
        
    2. reviewboard/accounts/models.py (Diff revision 5)
       
       
      Show all issues
      David and I discussed this design a bit more, and want to make a change here.
      
      A ManyToManyField here would cause a lot of extra database queries. ManyToManyFields create an extra, hidden table that maps the Trophy and LocalSiteProfile, and we don't need that.
      
      We also don't want to tie this to LocalSiteProfile anymore.
      
      So what we'd like is 2 new fields on Trophy instead. Both are ForeignKeys, just like the review_request one.
      
      One would point to User, and the other to LocalSite (which should have null=True, since there might not be a LocalSite for the trophy).
      
      You will need to erase your evolution file and generate a new one. That would mean going back to your database backup first, and starting just like you did when you wrote this.
      
      Hope that makes sense. Let me know if you'd like any more explanation!
    3. 
        
    HI
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/accounts/models.py
        Ignored Files:
      
      
    2. 
        
    HI
    chipx86
    1. 
        
    2. reviewboard/accounts/models.py (Diff revision 6)
       
       
      Show all issues
      256 is a bit long. 16 bytes should be more than enough.
      
      We should define each type of trophy we want as constants on the class. For example:
      
          FISH = 'fish'
          MILESTONE = 'milestone'
    3. reviewboard/accounts/models.py (Diff revision 6)
       
       
      Show all issues
      'received'. Note the order of 'i' and 'e'.
      
      I would just call it 'timestamp' though.
      
      Also it should default to 'now', using default=timezone.now. See reviews/models.py for an example.
    4. 
        
    HI
    reviewbot
    1. This is a review from Review Bot.
        Tool: PEP8 Style Checker
        Processed Files:
          reviewboard/accounts/models.py
        Ignored Files:
      
      
    2. 
        
    HI
    HI
    Review request changed
    Status:
    Discarded