models.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:django-billometer 作者: tcpcloud 项目源码 文件源码
def get_allocation_price(self, resource, name=None, today=None):

        quota = self.get_quota(resource, name)

        if quota == -1:
            return 0

        if today is None:
            today = date.today()

        rate = self.get_rate(resource, name)
        #month_range = calendar.monthrange(today.year, today.month)[1]
        # for variable month days/hours
        #price = decimal.Decimal('0.24') * rate * decimal.Decimal(quota) * decimal.Decimal(month_range)
        # for fixed month days/hours: 730
        price = D('73.0') * rate * decimal.Decimal(quota)

        return price
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号