Code review comment for lp:~diegosarmentero/ubuntuone-control-panel/quota-warning

Revision history for this message
Natalia Bidart (nataliabidart) wrote :

The following method does not indent the multiline guard properly. I would advice something like:

def show_quota_warning(int_bytes_used, int_bytes_total):
    """Return True if the user should be warn about the remaining quota."""
    available = (int_bytes_total - int_bytes_used)
    free_threshold = (int_bytes_total == FREE_ACCOUNT_SIZE and
                      available <= QUOTA_THRESHOLD_ACCOUNTS['free'])
    payed_threshold = (int_bytes_total > FREE_ACCOUNT_SIZE and
                       available <= QUOTA_THRESHOLD_ACCOUNTS['pay'])
    return free_threshold or payed_threshold

For the constants about quota, I would change these:

1 +FREE_ACCOUNT_SIZE = 5368709120
27 +QUOTA_THRESHOLD_ACCOUNTS = {'free': 536870912, 'pay': 3221225472}

to be:

        FREE_ACCOUNT_SIZE = (BYTES**3) * 5 # 5 gigs
        QUOTA_THRESHOLD_ACCOUNTS = {'free': FREE_ACCOUNT_SIZE * 0.1, # 10% of the free account size
                                    'pay': (BYTES**3) * 3} # 3 gigs

The rest looks good!

review: Needs Fixing

« Back to merge proposal