Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
fix: finally correcting a weird bug on how the files are threated in …
Browse files Browse the repository at this point in the history
…the backend
  • Loading branch information
jagalindo committed Aug 25, 2023
1 parent a795203 commit 0468fe1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 17 deletions.
28 changes: 14 additions & 14 deletions flamapy/interfaces/python/FLAMAFeatureModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,21 +286,21 @@ def valid_configuration(self, configurationPath:str):
except:
return None
def commonality(self, configurationPath:str):
"""
This is a measure of how often a feature appears in the products of a
product line. It's usually expressed as a percentage. A feature with
100% commonality is a core feature, as it appears in all products.
"""
try:
self._transform_to_sat()
configuration = self.dm.use_transformation_t2m(configurationPath,'configuration')
"""
This is a measure of how often a feature appears in the products of a
product line. It's usually expressed as a percentage. A feature with
100% commonality is a core feature, as it appears in all products.
"""
try:
self._transform_to_sat()
configuration = self.dm.use_transformation_t2m(configurationPath,'configuration')

operation = self.dm.get_operation(self.sat_model,'Glucose3Commonality')
operation.set_configuration(configuration)
operation.execute(self.sat_model)
return operation.get_result()
except:
return None
operation = self.dm.get_operation(self.sat_model,'Glucose3Commonality')
operation.set_configuration(configuration)
operation.execute(self.sat_model)
return operation.get_result()
except:
return None

def valid_product(self, configurationPath:str):
"""
Expand Down
11 changes: 8 additions & 3 deletions flamapy/interfaces/rest/operations_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,23 @@ def _api_call(operation_name:str):
MODEL_FOLDER, uploaded_model.filename))

operation =getattr(fm,operation_name)
print(operation_name)

if(operation_name=='feature_ancestors'):
result= operation(request.form["feature"])
elif(operation_name=='valid_product' or
operation_name=='valid_configuration' or
operation_name=='filter' or
operation_name=="commonality"):

result= operation(request.form["configuration"])
configuration=request.files["configuration"]
configuration.save(os.path.join(
MODEL_FOLDER, configuration.filename))

result= operation(os.path.join(
MODEL_FOLDER, configuration.filename))
else:
result= operation()
print(result)

# Remove file
os.remove(os.path.join(MODEL_FOLDER, uploaded_model.filename))

Expand Down

0 comments on commit 0468fe1

Please sign in to comment.