Skip to content

Commit

Permalink
Merge pull request #87 from Agriworks/bug-A2-47
Browse files Browse the repository at this point in the history
Bug a2 47
  • Loading branch information
keshavm02 authored Jun 18, 2021
2 parents 34cff97 + 1144fcf commit 50b8517
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Controllers/AgriWatchViewController.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def post(self):
class FetchViews(Resource):
@view_ns.doc(
responses = {
400: "Fetch AgriWatch views error."
400: "Error fetching AgriWatch views."
},
params = {
'SID': {'in': 'cookies', 'required': True},
Expand Down
2 changes: 1 addition & 1 deletion Controllers/AuthenticationController.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def post(self):
AuthenticationService.logout(sessionId)
return Response("Successfully logged out.", status=200)
except:
return Response("Unable to process request. Please reload and try again later.", status=400)
return Response("Unable to logout. Please reload and try again later.", status=400)

@auth_ns.route("/signup")
class Signup(Resource):
Expand Down
20 changes: 10 additions & 10 deletions Controllers/DatasetController.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def delete(self, datasetId):
class Search(Resource):
@dataset_ns.doc(
responses={
400: "Error processing request. Please try again later.",
400: "Error processing search request. Please try again later.",
400: "Unable to retrieve datasets with the given search parameter.",
},
params={
Expand Down Expand Up @@ -228,7 +228,7 @@ def get(self, searchQuery):
typeUser = False
else:
# invalid referrer url
return Response("Error processing request. Please try again later.", status=400)
return Response("Error processing search request. Please try again later.", status=400)

for dataset in matchedDatasets:
datasets.append(DatasetService.createDatasetInfoObject(dataset))
Expand All @@ -244,7 +244,7 @@ def get(self, searchQuery):
class GetUsersDatasets(Resource):
@dataset_ns.doc(
responses={
400: "No datasets found",
400: "No user datasets found",
},
params={
'SID': {'in': 'cookies', 'required': True},
Expand All @@ -257,15 +257,15 @@ def get(self):
datasets = Dataset.objects.filter(author=user).order_by('-dateCreated')
for dataset in datasets:
if dataset == None:
return Response("No datasets found", status=400)
return Response("No user datasets found", status=400)
retList.append(DatasetService.createDatasetInfoObject(dataset))
return Response(retList)

@dataset_ns.route("/popular/")
class Popular(Resource):
@dataset_ns.doc(
responses={
400: "No datasets found",
400: "No popular datasets found",
400: "Couldn't retrieve popular datasets"
},
params={
Expand All @@ -280,7 +280,7 @@ def get(self):
datasets = Dataset.objects.filter(Q(author=user) | Q(public=True)).order_by("-views")[:5]
for dataset in datasets:
if dataset == None:
return Response("No datasets found", status=400)
return Response("No popular datasets found", status=400)
retList.append(DatasetService.createDatasetInfoObject(dataset))
return Response(retList)
except:
Expand Down Expand Up @@ -319,8 +319,8 @@ def get(self):
class New(Resource):
@dataset_ns.doc(
responses={
400: "Couldn't retrieve recent datasets",
404: "No datasets found"
400: "Couldn't retrieve new datasets",
404: "No new datasets found"
},
params={
'SID': {'in': 'cookies', 'required': True},
Expand All @@ -335,12 +335,12 @@ def get(self):
newDatasets = Dataset.objects(author=user).order_by("-dateCreated")[:5]
for dataset in newDatasets:
if dataset == None:
return Response("No datasets found", status=404)
return Response("No new datasets found", status=404)
retList.append(DatasetService.createDatasetInfoObject(dataset))
return Response(retList)
except Exception as e:
print(e)
return Response("Couldn't retrieve recent datasets", status=400)
return Response("Couldn't retrieve new datasets", status=400)

@dataset_ns.route("/changeLabel/")
class ChangeLabel(Resource):
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ MarkupSafe==1.1.1
mccabe==0.6.1
mongoengine==0.18.2
more-itertools==7.2.0
numpy==1.17.4
pandas==0.25.3
numpy==1.20.3
pandas==1.2.4
pylint==2.4.2
pymongo==3.9.0
pyrsistent==0.15.4
Expand All @@ -34,7 +34,7 @@ PyYAML==5.2
s3transfer==0.2.1
six==1.12.0
sendgrid==6.4.4
typed-ast==1.4.0
typed-ast==1.4.3
urllib3==1.25.7
Werkzeug==0.16.0
wrapt==1.11.2
Expand Down

0 comments on commit 50b8517

Please sign in to comment.