Skip to content

Commit

Permalink
Merge pull request #31 from RPA-US/develop
Browse files Browse the repository at this point in the history
Unique exp names per user & seed_log not saved
  • Loading branch information
a8081 authored Sep 6, 2023
2 parents a300253 + ebeb1ee commit 8eb628d
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bpmloggenerator/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
EMAIL_HOST = env('EMAIL_HOST')
EMAIL_PORT = 587
# EMAIL_PORT = 465
DEFAULT_FROM_EMAIL = env('EMAIL_HOST_USER')
DEFAULT_FROM_EMAIL = env('EMAIL_FROM')
EMAIL_HOST_USER = env('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = True
Expand Down
2 changes: 1 addition & 1 deletion bpmloggenerator/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@
EMAIL_HOST = env('EMAIL_HOST')
EMAIL_PORT = 587
# EMAIL_PORT = 465
DEFAULT_FROM_EMAIL = env('EMAIL_HOST_USER')
DEFAULT_FROM_EMAIL = env('EMAIL_FROM')
EMAIL_HOST_USER = env('EMAIL_HOST_USER')
EMAIL_HOST_PASSWORD = env('EMAIL_HOST_PASSWORD')
EMAIL_USE_TLS = True
Expand Down
2 changes: 1 addition & 1 deletion configuration/db_populate_v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@
"username": "admin",
"first_name": "",
"last_name": "",
"email": "info@processautomation.es",
"email": "amrojas@us.es",
"is_staff": true,
"is_active": true,
"date_joined": "2022-03-10T10:18:41.361Z",
Expand Down
3 changes: 2 additions & 1 deletion experiments/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Experiment(models.Model):
number_scenarios = models.IntegerField(null=True, blank=True)
variability_conf = models.JSONField(null=True, blank=True)
scenarios_conf = models.JSONField(null=True, blank=True)
seed = models.CharField(null=True, blank=True, max_length=2500)
seed_log = models.CharField(null=True, blank=True, max_length=2500)
special_colnames = models.JSONField(null=True, blank=True)
screenshots = PrivateFileField("Screenshots", null=True)
screenshots_path = models.CharField(null=True, blank=True, max_length=255)
Expand All @@ -39,6 +39,7 @@ class Experiment(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='ExperimentOwner')

class Meta:
unique_together = ['name', 'user']
ordering = ["-created_at"]

def __str__(self):
Expand Down
2 changes: 1 addition & 1 deletion experiments/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ExperimentSerializer(serializers.ModelSerializer):
class Meta:
model = Experiment
depth = 1
fields = ['id', 'created_at', 'last_edition', 'execution_start', 'execution_finish', 'size_balance', 'seed','name', 'description', 'number_scenarios',
fields = ['id', 'created_at', 'last_edition', 'execution_start', 'execution_finish', 'size_balance', 'seed_log','name', 'description', 'number_scenarios',
'variability_conf', 'scenarios_conf', 'special_colnames', 'is_being_processed', 'is_active', 'status', 'screenshots_path', 'foldername',
'screenshot_name_generation_function', 'public', 'user']

Expand Down
7 changes: 4 additions & 3 deletions experiments/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def post(self, request, *args, **kwargs):
description=request.data.get('description'),
number_scenarios=int(request.data.get('number_scenarios')) if request.data.get(
'number_scenarios') else None,
seed=request.data.get('seedLog') if request.data.get(
'seedLog') else None,
seed_log=request.data.get('seed_log') if request.data.get(
'seed_log') else None,
variability_conf=json_attributes_load(request.data.get(
'variability_conf')) if request.data.get('variability_conf') else None,
scenarios_conf=json_attributes_load(request.data.get(
Expand Down Expand Up @@ -199,7 +199,7 @@ def put(self, request, id, *args, **kwars):
if request.data.get('number_scenarios') and int(request.data.get('number_scenarios')) > 0 and not ('scenarios_conf' in request.data):
return Response({"message": "POST experiment executing - Incomplete data: Number scenarios greater than 1 and no scenario configuration included!"}, status=status.HTTP_400_BAD_REQUEST)
for data in ['size_balance', 'name', 'number_scenarios',
'variability_conf',
'variability_conf', 'seed_log',
'special_colnames', 'screenshot_name_generation_function']:
if not data in request.data:
return Response({"message": "POST experiment executing - Incomplete data: " + data + " not included"}, status=status.HTTP_400_BAD_REQUEST)
Expand All @@ -221,6 +221,7 @@ def put(self, request, id, *args, **kwars):
request.data.get('size_balance'))
experiment.name = request.data.get('name')
experiment.description = request.data.get('description')
experiment.seed_log = request.data.get('seed_log')
experiment.number_scenarios = int(request.data.get(
'number_scenarios')) if request.data.get('number_scenarios') else None
experiment.variability_conf = json_attributes_load(request.data.get(
Expand Down

0 comments on commit 8eb628d

Please sign in to comment.