Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed invalid url old timerseries #494

Conversation

Shrhawk
Copy link
Contributor

@Shrhawk Shrhawk commented May 19, 2023

Checklist:

@Shrhawk
Copy link
Contributor Author

Shrhawk commented May 19, 2023

#493

Copy link
Member

@aptiko aptiko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. The commit message needs proper capitalization and spelling, and should also be in the imperative. It should also have (fixes #493) in the end. (See also "Git and GitHub" [section "Commit and commit messages"] in Confluence.)
  2. I found out that this problem also occurs in the new URLs after all, not only in the deprecated; for example, under /api/stations/2012/timeseriesgroups/584/timeseries/{hello}/data/. This means the commit message should not mention the "old" URL. It could be, for example, Fix crash in invalid timeseries URL (fixes #493).

Comment on lines +22 to +23
.DS_STORE
.idea/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please don't make irrelevant changes in the commit (see also "Git and GitHub" (section "Committing and commit messages") in Confluence)
  2. Please don't store in .gitignore things related to your personal development environment. You can use your personal .gitignore file for that (it's probably ~/.gitignore.

@@ -237,7 +238,7 @@ def data(self, request, pk=None, *, station_id, timeseries_group_id=None):

@action(detail=True, methods=["get"])
def bottom(self, request, pk=None, *, station_id, timeseries_group_id=None):
ts = get_object_or_404(models.Timeseries, pk=pk)
ts = get_object_or_404(models.Timeseries, pk=int(pk))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this working before? If yes, why is this change needed? (And how on earth was it working?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes @aptiko it was working fine, just make it consistent for the views

@@ -246,7 +247,7 @@ def bottom(self, request, pk=None, *, station_id, timeseries_group_id=None):

@action(detail=True, methods=["get"])
def chart(self, request, pk=None, *, station_id, timeseries_group_id=None):
timeseries = get_object_or_404(models.Timeseries, pk=pk)
timeseries = get_object_or_404(models.Timeseries, pk=int(pk))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question.

@@ -167,6 +167,7 @@ class TimeseriesViewSet(ModelViewSet):
CHART_MAX_INTERVALS = 200
queryset = models.Timeseries.objects.all()
serializer_class = serializers.TimeseriesSerializer
lookup_value_regex = '\d+'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this line is added, then I can't reproduce the problem any more. If that is the case, why do we have the try...except in _get_data()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@aptiko added try catch at _get_data() here bcz it's not the direct part of view, can be called anywhere from the code

@Shrhawk
Copy link
Contributor Author

Shrhawk commented May 23, 2023

Closed in favor of #495 (renamed the branch)

@Shrhawk Shrhawk closed this May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants