Fix price calculation
This commit is contained in:
		
					parent
					
						
							
								f80496a103
							
						
					
				
			
			
				commit
				
					
						46b918d175
					
				
			
		
					 2 changed files with 2 additions and 2 deletions
				
			
		| 
						 | 
					@ -41,7 +41,7 @@ class HostingPlan(models.Model):
 | 
				
			||||||
                for cfg in cls.objects.all()]
 | 
					                for cfg in cls.objects.all()]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def price(self):
 | 
					    def price(self):
 | 
				
			||||||
        price = self.disk_size * 0.2
 | 
					        price = self.disk_size * 0.6
 | 
				
			||||||
        price += self.cpu_cores * 5
 | 
					        price += self.cpu_cores * 5
 | 
				
			||||||
        price += self.memory * 2
 | 
					        price += self.memory * 2
 | 
				
			||||||
        return price
 | 
					        return price
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -135,7 +135,7 @@ class VirtualMachineSerializer(serializers.Serializer):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def get_price(self, obj):
 | 
					    def get_price(self, obj):
 | 
				
			||||||
        template = obj.template
 | 
					        template = obj.template
 | 
				
			||||||
        price = float(template.cpu) * 5.0
 | 
					        price = float(template.vcpu) * 5.0
 | 
				
			||||||
        price += (int(template.memory)/1024 * 2.0)
 | 
					        price += (int(template.memory)/1024 * 2.0)
 | 
				
			||||||
        for disk in template.disks:
 | 
					        for disk in template.disks:
 | 
				
			||||||
            price += int(disk.size)/1024 * 0.6
 | 
					            price += int(disk.size)/1024 * 0.6
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue