Skip to content
Snippets Groups Projects
Commit 5f0d397b authored by Fabio Vitello's avatar Fabio Vitello
Browse files

Defined Resource Type and Unit

SOS can:
- Define resource Unit
- Define Resouce Type
- Create Quota(s) for the defined resource(s)
- Assign quota to a project
parent e3596aed
No related branches found
No related tags found
1 merge request!111Resolve TMSS-165
...@@ -128,11 +128,11 @@ class CopyReason(AbstractChoice): ...@@ -128,11 +128,11 @@ class CopyReason(AbstractChoice):
class ResourceUnit(AbstractChoice): class ResourceUnit(AbstractChoice):
"""Defines the model and predefined list of possible Unit's for Resources. """Defines the model and predefined list of possible Unit's for Resources.
The items in the Choises class below are automagically populated into the database via a data migration.""" The items in the Choises class below are automagically populated into the database via a data migration."""
class Choices(Enum): # class Choices(Enum):
GIGABYTE = "Gigabyte" # GIGABYTE = "Gigabyte"
TERABYTE = "Terabyte" # TERABYTE = "Terabyte"
MINUTES = "Minutes" # MINUTES = "Minutes"
HOURS = "Hours" # HOURS = "Hours"
# concrete models # concrete models
...@@ -219,12 +219,13 @@ class Project(NamedCommonPK): ...@@ -219,12 +219,13 @@ class Project(NamedCommonPK):
class ProjectQuotum(NamedCommonPK): class ProjectQuotum(NamedCommonPK):
project = ForeignKey('Project', related_name="project_quotums", on_delete=PROTECT, help_text='Project to wich this quota belongs.') # protected to avoid accidents project = ForeignKey('Project', related_name="project_quotums", on_delete=PROTECT, help_text='Project to wich this quota belongs.') # protected to avoid accidents
resource = FloatField(help_text='Resource Quota value')
resource_type = ForeignKey('ResourceType', related_name="resource_type", on_delete=PROTECT, help_text='Resource type.') # protected to avoid accidents
#lta_storage = FloatField(help_text='LTA storage offered for the project') #lta_storage = FloatField(help_text='LTA storage offered for the project')
#observation_hours = IntegerField(help_text='Number of offered hours for observations.') #observation_hours = IntegerField(help_text='Number of offered hours for observations.')
#processing_hours = IntegerField(help_text='Number of offered hours for processing.') #processing_hours = IntegerField(help_text='Number of offered hours for processing.')
class ResourceType(NamedCommonPK): class ResourceType(NamedCommonPK):
resource = FloatField(help_text='Resource value')
resource_unit = ForeignKey('ResourceUnit', null=False, on_delete=PROTECT, help_text='Unit of current resource.') resource_unit = ForeignKey('ResourceUnit', null=False, on_delete=PROTECT, help_text='Unit of current resource.')
class SchedulingSet(NamedCommon): class SchedulingSet(NamedCommon):
......
...@@ -123,7 +123,7 @@ class ProjectQuotumSerializer(RelationalHyperlinkedModelSerializer): ...@@ -123,7 +123,7 @@ class ProjectQuotumSerializer(RelationalHyperlinkedModelSerializer):
class Meta: class Meta:
model = models.ProjectQuotum model = models.ProjectQuotum
fields = '__all__' fields = '__all__'
extra_fields = ['name'] extra_fields = ['name','resource_type']
class ResourceTypeSerializer(RelationalHyperlinkedModelSerializer): class ResourceTypeSerializer(RelationalHyperlinkedModelSerializer):
class Meta: class Meta:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment