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

#52 #55

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

#52 #55

wants to merge 19 commits into from

Conversation

platsajacki
Copy link
Collaborator

No description provided.

@platsajacki platsajacki linked an issue Mar 21, 2024 that may be closed by this pull request
Copy link
Owner

@Yakov-Varnaev Yakov-Varnaev left a comment

Choose a reason for hiding this comment

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

  1. Fix naming as it is a bit off the topic of the feature
  2. Don't use batteries if they don't solve your problem. It seems like neither filter forms nor Dango filters help us to make querying sufficient
  3. We need more test cases.

Tests I'd like to see:

  • One point has multiple stocks and usages
  • Two points have multiple stocks and usages in the same period
  • Two points have multiple stocks and usages in the non-intersecting periods
  • One point has stocks and usages and the other is the empty one.

src/companies/api/serializers/point.py Outdated Show resolved Hide resolved
src/companies/api/filters.py Outdated Show resolved Hide resolved
src/companies/models/material.py Outdated Show resolved Hide resolved
src/companies/models/material.py Outdated Show resolved Hide resolved
tests/apps/companies/test_consumable_material_viewset.py Outdated Show resolved Hide resolved
tests/apps/companies/test_consumable_material_viewset.py Outdated Show resolved Hide resolved
tests/apps/companies/test_consumable_material_viewset.py Outdated Show resolved Hide resolved
tests/apps/companies/test_consumable_material_viewset.py Outdated Show resolved Hide resolved
src/companies/models/material.py Outdated Show resolved Hide resolved
src/companies/models/material.py Outdated Show resolved Hide resolved
src/companies/services/materials_statistic/validator.py Outdated Show resolved Hide resolved
@@ -33,3 +40,17 @@ def add_employees(self, *args: Any, **kwargs: Any) -> Response:
serializer = EmployeeSerializer(data=self.request.data, context=self.get_serializer_context(*args, **kwargs))
employee = EmployeeCreator(serializer)()
return Response(EmployeeSerializer(employee).data)


class MaterialsStatisticViewSet(ModelViewSet):
Copy link
Owner

Choose a reason for hiding this comment

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

We only need listing here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Are you saying that we won't have a retrieve logic at the front? Do I need to remove the retrieve method?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can use mixins.ListModelMixin and GenericViewSet.

src/companies/api/viewsets/point.py Outdated Show resolved Hide resolved
),
data=material_date_query_params,
)
for movement in [response["stocks"], response["usage"]]:
Copy link
Owner

Choose a reason for hiding this comment

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

What is movement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the movement of materials. That is, delivery to the point and use.

tests/apps/companies/test_materials_statistic_viewset.py Outdated Show resolved Hide resolved
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.

Materials uses/stock endpoints
2 participants