-
Notifications
You must be signed in to change notification settings - Fork 17
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
change sort ordering and date displays on dashboards #2320
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
66b6545
change sort ordering and date displays on dashboards
richard-jones 03a86ef
switch reference to created_date to date_applied
richard-jones 57364a3
Merge branch 'develop' into feature/3733_dashboard_sort_adjustments
Steven-Eardley ba7442e
update sort date ordering from created_date to date_applied
richard-jones 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,7 @@ def _rationalise_todos(self, todos, size): | |
class TodoRules(object): | ||
@classmethod | ||
def maned_stalled(cls, size, maned_of): | ||
sort_date = "created_date" | ||
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. can be extract to global variable |
||
stalled = TodoQuery( | ||
musts=[ | ||
TodoQuery.lmu_older_than(8), | ||
|
@@ -166,13 +167,14 @@ def maned_stalled(cls, size, maned_of): | |
must_nots=[ | ||
TodoQuery.status([constants.APPLICATION_STATUS_ACCEPTED, constants.APPLICATION_STATUS_REJECTED]) | ||
], | ||
sort="last_manual_update", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_MANED_STALLED, stalled, "last_manual_update", 0 | ||
return constants.TODO_MANED_STALLED, stalled, sort_date, 0 | ||
|
||
@classmethod | ||
def maned_follow_up_old(cls, size, maned_of): | ||
sort_date = "created_date" | ||
follow_up_old = TodoQuery( | ||
musts=[ | ||
TodoQuery.cd_older_than(10), | ||
|
@@ -181,38 +183,41 @@ def maned_follow_up_old(cls, size, maned_of): | |
must_nots=[ | ||
TodoQuery.status([constants.APPLICATION_STATUS_ACCEPTED, constants.APPLICATION_STATUS_REJECTED]) | ||
], | ||
sort="created_date", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_MANED_FOLLOW_UP_OLD, follow_up_old, "created_date", 0 | ||
return constants.TODO_MANED_FOLLOW_UP_OLD, follow_up_old, sort_date, 0 | ||
|
||
@classmethod | ||
def maned_ready(cls, size, maned_of): | ||
sort_date = "created_date" | ||
ready = TodoQuery( | ||
musts=[ | ||
TodoQuery.status([constants.APPLICATION_STATUS_READY]), | ||
TodoQuery.editor_group(maned_of) | ||
], | ||
sort="last_manual_update", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_MANED_READY, ready, "created_date", 1 | ||
return constants.TODO_MANED_READY, ready, sort_date, 1 | ||
|
||
@classmethod | ||
def maned_completed(cls, size, maned_of): | ||
sort_date = "created_date" | ||
completed = TodoQuery( | ||
musts=[ | ||
TodoQuery.status([constants.APPLICATION_STATUS_COMPLETED]), | ||
TodoQuery.lmu_older_than(2), | ||
TodoQuery.editor_group(maned_of) | ||
], | ||
sort="last_manual_update", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_MANED_COMPLETED, completed, "last_manual_update", 0 | ||
return constants.TODO_MANED_COMPLETED, completed, sort_date, 0 | ||
|
||
@classmethod | ||
def maned_assign_pending(cls, size, maned_of): | ||
sort_date = "created_date" | ||
assign_pending = TodoQuery( | ||
musts=[ | ||
TodoQuery.exists("admin.editor_group"), | ||
|
@@ -223,13 +228,14 @@ def maned_assign_pending(cls, size, maned_of): | |
must_nots=[ | ||
TodoQuery.exists("admin.editor") | ||
], | ||
sort="created_date", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_MANED_ASSIGN_PENDING, assign_pending, "last_manual_update", 0 | ||
return constants.TODO_MANED_ASSIGN_PENDING, assign_pending, sort_date, 0 | ||
|
||
@classmethod | ||
def editor_stalled(cls, groups, size): | ||
sort_date = "created_date" | ||
stalled = TodoQuery( | ||
musts=[ | ||
TodoQuery.lmu_older_than(6), | ||
|
@@ -243,13 +249,14 @@ def editor_stalled(cls, groups, size): | |
constants.APPLICATION_STATUS_READY | ||
]) | ||
], | ||
sort="last_manual_update", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_EDITOR_STALLED, stalled, "last_manual_update", 0 | ||
return constants.TODO_EDITOR_STALLED, stalled, sort_date, 0 | ||
|
||
@classmethod | ||
def editor_follow_up_old(cls, groups, size): | ||
sort_date = "created_date" | ||
follow_up_old = TodoQuery( | ||
musts=[ | ||
TodoQuery.cd_older_than(8), | ||
|
@@ -263,26 +270,28 @@ def editor_follow_up_old(cls, groups, size): | |
constants.APPLICATION_STATUS_READY | ||
]) | ||
], | ||
sort="created_date", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_EDITOR_FOLLOW_UP_OLD, follow_up_old, "created_date", 0 | ||
return constants.TODO_EDITOR_FOLLOW_UP_OLD, follow_up_old, sort_date, 0 | ||
|
||
@classmethod | ||
def editor_completed(cls, groups, size): | ||
sort_date = "created_date" | ||
completed = TodoQuery( | ||
musts=[ | ||
TodoQuery.status([constants.APPLICATION_STATUS_COMPLETED]), | ||
TodoQuery.editor_groups(groups), | ||
TodoQuery.is_new_application() | ||
], | ||
sort="last_manual_update", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_EDITOR_COMPLETED, completed, "last_manual_update", 1 | ||
return constants.TODO_EDITOR_COMPLETED, completed, sort_date, 1 | ||
|
||
@classmethod | ||
def editor_assign_pending(cls, groups, size): | ||
sort_date = "created_date" | ||
assign_pending = TodoQuery( | ||
musts=[ | ||
TodoQuery.editor_groups(groups), | ||
|
@@ -292,14 +301,14 @@ def editor_assign_pending(cls, groups, size): | |
must_nots=[ | ||
TodoQuery.exists("admin.editor") | ||
], | ||
sort="created_date", | ||
sort=sort_date, | ||
size=size | ||
) | ||
return constants.TODO_EDITOR_ASSIGN_PENDING, assign_pending, "created_date", 1 | ||
return constants.TODO_EDITOR_ASSIGN_PENDING, assign_pending, sort_date, 1 | ||
|
||
@classmethod | ||
def associate_stalled(cls, acc_id, size): | ||
sort_field = "last_manual_update" | ||
sort_field = "created_date" | ||
stalled = TodoQuery( | ||
musts=[ | ||
TodoQuery.lmu_older_than(3), | ||
|
@@ -383,7 +392,10 @@ class TodoQuery(object): | |
~~^->Elasticsearch:Technology~~ | ||
""" | ||
lmu_sort = {"last_manual_update" : {"order" : "asc"}} | ||
cd_sort = {"created_date" : {"order" : "asc"}} | ||
# cd_sort = {"created_date" : {"order" : "asc"}} | ||
# NOTE that admin.date_applied and created_date should be the same for applications, but for some reason this is not always the case | ||
# therefore, we take a created_date sort to mean a date_applied sort | ||
cd_sort = {"admin.date_applied": {"order": "asc"}} | ||
|
||
def __init__(self, musts=None, must_nots=None, sort="last_manual_update", size=10): | ||
self._musts = [] if musts is None else musts | ||
|
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
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.
can be extract for other
build_application
to reuse