Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

[RAINCATCH-1180] Hide Completed Workorders #131

Merged
merged 6 commits into from Sep 22, 2017

Conversation

paolobueno
Copy link
Contributor

Motivation

Stop syncing old completed workorders to the mobile client to avoid data clutter and excess data flow.
Keep workorders available for the portal.

Description

  • Add tracking for workorder status
  • Add extensibility option for server-side mongodb list filter
  • Add filter+configuration for excluding workorders completed X days ago

Progress

  • History tracking
  • custom list filters
  • completed workorder filter
  • Unit tests

@coveralls
Copy link

coveralls commented Sep 21, 2017

Coverage Status

Changes Unknown when pulling a952d27 on RAINCATCH-1180-hide-completed into ** on master**.

@paolobueno
Copy link
Contributor Author

paolobueno commented Sep 21, 2017

To verify:

  • Complete a workorder via the mobile app
  • Manually update the workorder's statusHistory.Complete to an older day. i.e. node -e 'console.log(new Date().setDate(new Date().getDate() - 3))' in mongo
  • Verify that the workorder disappears on the next sync cycle

@coveralls
Copy link

coveralls commented Sep 21, 2017

Coverage Status

Changes Unknown when pulling b2901c5 on RAINCATCH-1180-hide-completed into ** on master**.

@@ -55,7 +55,8 @@ var config = {
},
"sync": {
// Required to handle UI.
"customDataHandlers": true
"customDataHandlers": true,
"excludeOldCompleteWorkOrders": 2
Copy link
Member

Choose a reason for hiding this comment

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

Name may be better. Days to filter complete workorders.

Copy link
Member

Choose a reason for hiding this comment

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

Also add comment

@@ -37,6 +38,10 @@ export function connect() {
}
if (config.sync.customDataHandlers) {
const handler = new GlobalMongoDataHandler(mongo);
const excludeDays = appConfig.getConfig().sync.excludeOldCompleteWorkOrders;
if (excludeDays > 0) {
handler.addListFilterModifier(excludeCompleteWorkOrders(excludeDays));
Copy link
Member

Choose a reason for hiding this comment

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

Awesome way of doing that where users can decide if they want this!
This needs to be documented.

* 'Complete': 1506010024468
* }
*/
statusHistory?: {
Copy link
Member

@wtrocki wtrocki Sep 22, 2017

Choose a reason for hiding this comment

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

[Question] Do we really need that for this bug?
How about relaying on status='FINISHED' and updated< moment.daysFromNow(2)

IMHO after finished workorder is being accepted it should be in read only mode in portal.
No strong feelings against that, but I will prefer for us to relay on timestamps on results and overall workflow markers to be simple.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I actually wanted this to be an array, since we might end up having workorders unassigned and reassigned to other users, they might hit the same status more than once in their lifetime and tracking all of that can lead to more detailed filtering and reporting. But the filter, while doable, could have some performance issues...

I know we don't expect workorders to be updated after they're complete, but there's always stuff like someone in the portal being able to update the workorder name, or maybe we add comments in the future that could also be added after it is complete, so relying on a separate timestamp is more future-proof too.

@paolobueno
Copy link
Contributor Author

@wtrocki addressed comments, thanks for review!

@paolobueno paolobueno merged commit 91e1c8e into master Sep 22, 2017
@paolobueno paolobueno deleted the RAINCATCH-1180-hide-completed branch September 22, 2017 14:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

None yet

3 participants