Skip to content

Commit

Permalink
figuring out opt_in function
Browse files Browse the repository at this point in the history
  • Loading branch information
XaelShan committed Jun 30, 2023
1 parent b09c707 commit 7bac6ca
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
2 changes: 0 additions & 2 deletions webfit/analyze/fitting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ class Fit(AnalysisBase):
import_example_data = [
]

fit_success = models.BooleanField(default = False, help_text= "Successful completion status of fit")

class FitParameter(AnalysisParameterBase):
Units = [

Expand Down
6 changes: 3 additions & 3 deletions webfit/analyze/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
models_logger = getLogger(__name__)

class AnalysisBase(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
id = models.BigAutoField(primary_key=True)
user_id = Data.user_id

GPU_enabled = models.BooleanField(default = False, help_text= "use GPU rather than CPU")
Expand All @@ -54,7 +54,7 @@ class AnalysisBase(models.Model):
is_public = models.BooleanField(default = False, help_text="does the user want their data to be public")

class AnalysisParameterBase(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
id = models.BigAutoField(primary_key=True)
name = models.CharField(max_length=100, help_text="Parameter Name")
"""datatype = models.FloatField()
Expand All @@ -69,7 +69,7 @@ class AnalysisParameterBase(models.Model):


class AnalysisModelBase(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
id = models.BigAutoField(primary_key=True)
name = models.CharField(max_length=300, help_text="name of analysis model")
#list of analysis parameters
parameters = [
Expand Down
3 changes: 1 addition & 2 deletions webfit/data/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@
# do we want individual dbs for each perspective?



class Data(models.Model):
id = models.UUIDField(primary_key=True, default = uuid.uuid4, editable=False)
id = models.BigAutoField(primary_key=True)

#user id
user_id = models.ForeignKey(User, default=None, on_delete=models.CASCADE)
Expand Down
3 changes: 2 additions & 1 deletion webfit/data/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
logger = logging.getLogger(__name__)

urlpatterns = [
path("import/<str:file_id>/", views.import_file_string, name = "import data"),
re_path(r"import/(?P<file_id>)/$", views.import_file_string, name = "import data"),
re_path(r"import/(?P<file_id>)/(?P<opt_in>)/$", views.import_file_string, name = "import data and opt in"),
path("export/", views.export_data, name = "export/save data")
]
13 changes: 9 additions & 4 deletions webfit/data/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


@api_view(['POST', 'PUT'])
def import_file_string(request, file_id, version):
def import_file_string(request, file_id, version, optional_parameter='opt_in'):

#saves file_string
if request.method == 'POST':
Expand Down Expand Up @@ -65,6 +65,11 @@ def export_data(request, save_file_id, version = None):
serializer.save()
return Response(serializer.data)
return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)

def export_to_example_data():




#do we want to automatically do this? no request
#add this as a function that can be called by export_data?
#how do we do this
def export_to_example_data(data):
#code here to download back to sasview...

0 comments on commit 7bac6ca

Please sign in to comment.