-
Notifications
You must be signed in to change notification settings - Fork 0
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
Calculate number of spares #417 #434
Open
joelvdavies
wants to merge
20
commits into
develop
Choose a base branch
from
calculate-number-of-spares-#417
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1bebf69
Initial spares calculation when updating definition #417
joelvdavies 6de588c
Initial working spares calculation for items updates #417
joelvdavies 996e7a8
Add some comments and clean up slightly #417
joelvdavies 48c60a4
Update mock data script and dump to include number of spares #417
joelvdavies 4237f52
Update and add repo unit tests #417
joelvdavies 1559a05
Update SettingService unit tests #417
joelvdavies d1480fb
Update ItemService unit tests #417
joelvdavies 4aae41e
Add unit tests to service utils #417
joelvdavies 162dcc5
Add missing assert in catalogue item service update test and align ot…
joelvdavies 6d6789d
Initial spares calculation e2e tests #413
joelvdavies 28c9838
Resolve outstanding todos and fix linting #417
joelvdavies e134cf9
Write lock all catalogue items when setting spares and reduce logs #417
joelvdavies 58a1e87
Add WriteConflictError to routers #417
joelvdavies e08e647
Update after merge #417
joelvdavies 49bb383
Fix tests and linting after rebase #417
joelvdavies 0f8e745
Initial implementation of preventing catalogue item creation while se…
joelvdavies 7dcc444
Fix write lock on catalogue items when spares definition not assigned…
joelvdavies 1008b31
Merge branch 'handle-property-migration-conflict-#412' into calculate…
joelvdavies 85a17d1
Update and add more tests #417
joelvdavies 1a13d12
Merge branch 'handle-property-migration-conflict-#412' into calculate…
joelvdavies File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -182,3 +182,22 @@ def update_names_of_all_properties_with_id( | |||||
) | ||||||
|
||||||
# pylint:enable=duplicate-code | ||||||
|
||||||
def count_with_usage_status_ids_in( | ||||||
self, | ||||||
catalogue_item_id: ObjectId, | ||||||
usage_status_ids: List[CustomObjectId], | ||||||
session: Optional[ClientSession] = None, | ||||||
) -> int: | ||||||
""" | ||||||
Counts the number of items within a catalogue item with a `usage_status_id` contained within the given list. | ||||||
|
||||||
:param catalogue_item_id: ID of the catalogue item for which items should be counted. | ||||||
:param usage_status_id: List of usage status IDs which should be included in the count. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
:param session: PyMongo ClientSession to use for database operations. | ||||||
:return: Number of items counted. | ||||||
""" | ||||||
|
||||||
return self._items_collection.count_documents( | ||||||
{"catalogue_item_id": catalogue_item_id, "usage_status_id": {"$in": usage_status_ids}}, session=session | ||||||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you make a note here to say why it is optional?