Skip to content

Ft admin asset Type threshold notification #329

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

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from

Conversation

kenneth051
Copy link
Collaborator

[Finishes #167967311]

What does this PR do?

alerts admins in case the asset type threshold drops below the default threshold

Description of Task to be completed?

Current, we are assigning assets to users and departments without keeping track of the current remaining assets. this PR addresses this issue and if the remaining assets go below the default asset threshold, then admins will be notified via email

How should this be manually tested?

  1. on postman, visit the endpoint http://127.0.0.1:8000/api/v1/allocationsthen assign an asset to a user

Any background context you want to provide?

start by migrating the models. run the command python manage.py migrate to apply the necessary changes.
Make sure in ur .env file you set the variable DEFAULT_THRESHOLDto a number for instance 20. then in the assettype model edit the fields by giving them a threshold value that we will compare with the DEFAULT_THRESHOLD.
set the email fields in your .env and give them values
MAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = " "
EMAIL_HOST_PASSWORD = " "
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_SENDER=" "
after starting the server, make sure you open another terminal tab and run the command python manage.py qcluster to start the qCluster

What are the relevant pivotal tracker stories?

https://www.pivotaltracker.com/n/projects/2146417/stories/167967311

@@ -542,6 +545,13 @@ def save(self, *args, **kwargs):
self.previous_assignee = None
try:
super().save(*args, **kwargs)
if self.previous_assignee is None:
threshold_data = self.asset.model_number.asset_make.asset_type
Copy link
Collaborator

Choose a reason for hiding this comment

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

This variable would be more descriptive if named asset_type. Then you can have asset_type.threshold = ....

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 91.309% when pulling 4278cd4 on ft-admin-assettype-threshold-notofication-167967311 into ea4c5cb on develop.

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.

3 participants