Skip to content

Commit

Permalink
Merge pull request #6052 from flexion/5511-remove-isqc
Browse files Browse the repository at this point in the history
5511: remove isQC from work items
  • Loading branch information
rachaelparris authored Jul 31, 2020
2 parents f7a7030 + e290e22 commit c422fe7
Show file tree
Hide file tree
Showing 83 changed files with 56 additions and 555 deletions.
4 changes: 0 additions & 4 deletions docs/entities/WorkItem.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@
type: "boolean"
flags:
presence: "optional"
isQC:
type: "boolean"
flags:
presence: "required"
isRead:
type: "boolean"
flags:
Expand Down
2 changes: 1 addition & 1 deletion shared/src/business/entities/Document.js
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ Document.prototype.setAsProcessingStatusAsCompleted = function () {
};

Document.prototype.getQCWorkItem = function () {
return this.workItems.find(workItem => workItem.isQC === true);
return this.workItems[0];
};

Document.prototype.isAutoServed = function () {
Expand Down
33 changes: 4 additions & 29 deletions shared/src/business/entities/Document.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,6 @@ describe('Document entity', () => {
caseTitle: 'Johnny Joe Jacobson',
docketNumber: '101-18',
document: {},
isQC: true,
section: 'petitions',
sentBy: 'bob',
},
Expand Down Expand Up @@ -1473,7 +1472,7 @@ describe('Document entity', () => {
});

describe('getQCWorkItem', () => {
it('returns the first workItem with isQC = true', () => {
it('returns the first workItem', () => {
const document = new Document(
{
...A_VALID_DOCUMENT,
Expand All @@ -1485,48 +1484,24 @@ describe('Document entity', () => {
caseTitle: 'Johnny Joe Jacobson',
docketNumber: '101-18',
document: {},
isQC: false,
sentBy: 'bill',
workItemId: 'dda4acce-7b0f-40e2-b5a7-261b5c0dee28',
},
{
assigneeId: '8b4cd447-6278-461b-b62b-d9e357eea62c',
assigneeName: 'bob',
caseStatus: CASE_STATUS_TYPES.NEW,
caseTitle: 'Johnny Joe Jacobson',
docketNumber: '101-18',
document: {},
isQC: true,
sentBy: 'bob',
workItemId: '062d334b-7589-4b28-9dcf-72989574b7a7',
},
],
},
{ applicationContext },
);

expect(document.getQCWorkItem()).toMatchObject({
workItemId: '062d334b-7589-4b28-9dcf-72989574b7a7',
workItemId: 'dda4acce-7b0f-40e2-b5a7-261b5c0dee28',
});
});

it('returns undefined if there is no QC work item', () => {
it('returns undefined if there is no work item', () => {
const document = new Document(
{
...A_VALID_DOCUMENT,
workItems: [
{
assigneeId: '49b4789b-3c90-4940-946c-95a700d5a501',
assigneeName: 'bill',
caseStatus: CASE_STATUS_TYPES.NEW,
caseTitle: 'Johnny Joe Jacobson',
docketNumber: '101-18',
document: {},
isQC: false,
sentBy: 'bill',
workItemId: 'dda4acce-7b0f-40e2-b5a7-261b5c0dee28',
},
],
workItems: [],
},
{ applicationContext },
);
Expand Down
7 changes: 0 additions & 7 deletions shared/src/business/entities/WorkItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ function WorkItem(rawWorkItem, { applicationContext }) {
this.highPriority = rawWorkItem.highPriority;
this.inProgress = rawWorkItem.inProgress;
this.isInitializeCase = rawWorkItem.isInitializeCase;
this.isQC = rawWorkItem.isQC;
this.isRead = rawWorkItem.isRead;
this.section = rawWorkItem.section;
this.sentBy = rawWorkItem.sentBy;
Expand Down Expand Up @@ -91,7 +90,6 @@ joiValidationDecorator(
highPriority: joi.boolean().optional(),
inProgress: joi.boolean().optional(),
isInitializeCase: joi.boolean().optional(),
isQC: joi.boolean().required(),
isRead: joi.boolean().optional(),
section: joi
.string()
Expand All @@ -118,11 +116,6 @@ joiValidationDecorator(
}),
);

WorkItem.prototype.setAsInternal = function () {
this.isQC = false;
return this;
};

/**
* Assign to a user
*
Expand Down
25 changes: 0 additions & 25 deletions shared/src/business/entities/WorkItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ describe('WorkItem', () => {
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
section: 'docket',
sentBy: 'bob',
},
Expand All @@ -39,7 +38,6 @@ describe('WorkItem', () => {
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
section: 'docket',
sentBy: 'bob',
},
Expand All @@ -50,26 +48,6 @@ describe('WorkItem', () => {
expect(workItem.isValid()).toBeTruthy();
});

it('Returns a reference to a valid workItem when calling setAsInternal', () => {
const workItem = new WorkItem(
{
assigneeId: '8b4cd447-6278-461b-b62b-d9e357eea62c',
assigneeName: 'bob',
caseTitle: 'Johnny Joe Jacobson',
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
section: 'docket',
sentBy: 'bob',
},
{ applicationContext },
);
const updatedWorkItem = workItem.setAsInternal();
expect(updatedWorkItem.isQC).toEqual(false);
expect(updatedWorkItem.isValid()).toBeTruthy();
});

it('Update a valid workitem with a workItemId', () => {
const workItem = new WorkItem(
{
Expand All @@ -80,7 +58,6 @@ describe('WorkItem', () => {
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
section: 'docket',
sentBy: 'bob',
workItemId: 'c6b81f4d-1e47-423a-8caf-6d2fdc3d3859',
Expand All @@ -100,7 +77,6 @@ describe('WorkItem', () => {
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
isRead: true,
section: 'docket',
sentBy: 'bob',
Expand All @@ -122,7 +98,6 @@ describe('WorkItem', () => {
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
sentBy: 'bob',
},
{ applicationContext },
Expand Down
2 changes: 0 additions & 2 deletions shared/src/business/entities/cases/Case.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1551,7 +1551,6 @@ describe('Case entity', () => {
caseTitle: 'Johnny Joe Jacobson',
docketNumber: '101-18',
document: {},
isQC: true,
sentBy: 'bob',
},
{ applicationContext },
Expand All @@ -1567,7 +1566,6 @@ describe('Case entity', () => {
caseTitle: 'Johnny Joe Jacobson',
docketNumber: '101-18',
document: {},
isQC: true,
sentBy: 'bob',
},
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ describe('serveCourtIssuedDocumentInteractor', () => {

const mockWorkItem = {
docketNumber: '101-20',
isQC: true,
section: DOCKET_SECTION,
sentBy: mockUser.name,
sentByUserId: mockUser.userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const addPetitionDocumentWithWorkItemToCase = ({
createdAt: documentEntity.createdAt,
},
isInitializeCase: true,
isQC: true,
section: user.section,
sentBy: user.name,
sentBySection: user.section,
Expand Down
1 change: 0 additions & 1 deletion shared/src/business/useCases/createCaseInteractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const addPetitionDocumentToCase = ({
createdAt: documentEntity.createdAt,
},
isInitializeCase: true,
isQC: true,
section: PETITIONS_SECTION,
sentBy: user.name,
sentByUserId: user.userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ exports.fileCourtIssuedDocketEntryInteractor = async ({
},
hideFromPendingMessages: true,
inProgress: true,
isQC: true,
section: DOCKET_SECTION,
sentBy: user.name,
sentByUserId: user.userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ exports.fileDocketEntryInteractor = async ({
createdAt: documentEntity.createdAt,
},
inProgress: isSavingForLater,
isQC: true,
isRead: user.role !== ROLES.privatePractitioner,
section: DOCKET_SECTION,
sentBy: user.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ describe('updateCourtIssuedDocketEntryInteractor', () => {
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
messages: [],
section: 'docket',
sentBy: 'bob',
Expand All @@ -106,7 +105,6 @@ describe('updateCourtIssuedDocketEntryInteractor', () => {
docketNumber: '101-18',
docketNumberSuffix: DOCKET_NUMBER_SUFFIXES.SMALL,
document: {},
isQC: true,
messages: [],
section: 'docket',
sentBy: 'bob',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ exports.updateDocketEntryInteractor = async ({
createdAt: documentEntity.createdAt,
},
inProgress: isSavingForLater,
isQC: true,
section: DOCKET_SECTION,
sentBy: user.userId,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ describe('updateDocketEntryInteractor', () => {
eventCode: 'A',
userId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb',
},
isQC: true,
section: 'docket',
sentBy: 'c54ba5a9-b37b-479d-9201-067ec6e335bb',
updatedAt: new Date().toISOString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ describe('completeDocketEntryQCInteractor', () => {
filedBy: 'Test Petitioner',
userId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb',
},
isQC: true,
section: 'docket',
sentBy: 'Test User',
sentByUserId: 'c54ba5a9-b37b-479d-9201-067ec6e335bb',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ exports.fileExternalDocumentForConsolidatedInteractor = async ({
...documentEntity.toRawObject(),
createdAt: documentEntity.createdAt,
},
isQC: true,
section: DOCKET_SECTION,
sentBy: user.name,
sentByUserId: user.userId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ exports.fileExternalDocumentInteractor = async ({
createdAt: documentEntity.createdAt,
},
highPriority: highPriorityWorkItem,
isQC: true,
section: DOCKET_SECTION,
sentBy: user.name,
sentByUserId: user.userId,
Expand Down
8 changes: 0 additions & 8 deletions shared/src/business/useCases/getNotificationsInteractor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@
* @returns {object} inbox unread message counts for the individual and section inboxes
*/
exports.getNotificationsInteractor = async ({ applicationContext }) => {
const messagesInbox = await applicationContext
.getPersistenceGateway()
.getInboxMessagesForUser({
applicationContext,
userId: applicationContext.getCurrentUser().userId,
});

const documentQCInbox = await applicationContext
.getPersistenceGateway()
.getDocumentQCInboxForUser({
Expand All @@ -21,7 +14,6 @@ exports.getNotificationsInteractor = async ({ applicationContext }) => {
});

return {
myInboxUnreadCount: messagesInbox.filter(item => !item.isRead).length,
qcUnreadCount: documentQCInbox.filter(item => !item.isRead).length,
};
};
35 changes: 3 additions & 32 deletions shared/src/business/useCases/getNotificationsInteractor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,75 +10,46 @@ describe('getNotificationsInteractor', () => {
.getPersistenceGateway()
.getDocumentQCInboxForUser.mockReturnValue([
{
isQC: false,
isRead: true,
},
]);

applicationContext
.getPersistenceGateway()
.getInboxMessagesForUser.mockReturnValue([
{
isQC: false,
isRead: false,
},
]);

const result = await getNotificationsInteractor({
applicationContext,
userId: 'docketclerk',
});
expect(result).toEqual({ myInboxUnreadCount: 1, qcUnreadCount: 0 });
expect(result).toEqual({ qcUnreadCount: 0 });
});

it('returns an unread count for qc messages', async () => {
applicationContext
.getPersistenceGateway()
.getDocumentQCInboxForUser.mockReturnValue([
{
isQC: false,
isRead: false,
},
]);

applicationContext
.getPersistenceGateway()
.getInboxMessagesForUser.mockReturnValue([
{
isQC: true,
isRead: true,
},
]);

const result = await getNotificationsInteractor({
applicationContext,
userId: 'docketclerk',
});
expect(result).toEqual({ myInboxUnreadCount: 0, qcUnreadCount: 1 });
expect(result).toEqual({ qcUnreadCount: 1 });
});

it('returns an accurate unread count for legacy items marked complete', async () => {
applicationContext
.getPersistenceGateway()
.getDocumentQCInboxForUser.mockReturnValue([
{
isQC: false,
isRead: true,
},
]);

applicationContext
.getPersistenceGateway()
.getInboxMessagesForUser.mockReturnValue([
{
isQC: false,
isRead: true,
},
]);
const result = await getNotificationsInteractor({
applicationContext,
userId: 'docketclerk',
});
expect(result).toEqual({ myInboxUnreadCount: 0, qcUnreadCount: 0 });
expect(result).toEqual({ qcUnreadCount: 0 });
});
});
Loading

0 comments on commit c422fe7

Please sign in to comment.