Skip to content

Commit d4668e2

Browse files
committed
remove review type option
1 parent 88db2c4 commit d4668e2

16 files changed

+18
-144
lines changed

src/bot/__tests__/getReviewInfo.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ describe('getReviewInfo', () => {
4646
languages: ['Java'],
4747
requestedAt: new Date(1650504468906),
4848
dueBy: Deadline.END_OF_DAY,
49-
reviewType: 'HackerRank',
5049
candidateIdentifier: 'some-id',
5150
reviewersNeededCount: 1,
5251
acceptedReviewers: [],

src/bot/__tests__/requestReview.test.ts

Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { ShortcutParam } from '@/slackTypes';
55
import { ActionId, Deadline, Interaction } from '@bot/enums';
66
import { requestReview } from '@bot/requestReview';
77
import { languageRepo } from '@repos/languageRepo';
8-
import { reviewTypesRepo } from '@repos/reviewTypesRepo';
98
import { App, SlackViewAction, UploadedFile, ViewStateValue } from '@slack/bolt';
109
import {
1110
buildMockCallbackParam,
@@ -78,9 +77,6 @@ describe('requestReview', () => {
7877
describe('when no errors occur', () => {
7978
beforeEach(async () => {
8079
languageRepo.listAll = jest.fn().mockResolvedValueOnce(['Javascript', 'Go', 'Other']);
81-
reviewTypesRepo.listAll = jest
82-
.fn()
83-
.mockResolvedValueOnce(['HackerRank', 'Moby Dick Project']);
8480

8581
await requestReview.shortcut(param);
8682
});
@@ -107,34 +103,10 @@ describe('requestReview', () => {
107103
});
108104
});
109105

110-
it('should setup the first response block for the review type', () => {
106+
it('should setup the first response block for the languages used', () => {
111107
const { mock } = param.client.views.open as jest.Mock;
112108
const blocks = mock.calls[0][0].view.blocks;
113109
expect(blocks[0]).toEqual({
114-
block_id: ActionId.REVIEW_TYPE,
115-
type: 'input',
116-
label: {
117-
text: 'What type of submission needs reviewed?',
118-
type: 'plain_text',
119-
},
120-
element: {
121-
type: 'static_select',
122-
action_id: ActionId.REVIEW_TYPE,
123-
options: [
124-
{ text: { text: 'HackerRank', type: 'plain_text' }, value: 'HackerRank' },
125-
{
126-
text: { text: 'Moby Dick Project', type: 'plain_text' },
127-
value: 'Moby Dick Project',
128-
},
129-
],
130-
},
131-
});
132-
});
133-
134-
it('should setup the second response block for the languages used', () => {
135-
const { mock } = param.client.views.open as jest.Mock;
136-
const blocks = mock.calls[0][0].view.blocks;
137-
expect(blocks[1]).toEqual({
138110
block_id: ActionId.LANGUAGE_SELECTIONS,
139111
type: 'input',
140112
label: {
@@ -153,10 +125,10 @@ describe('requestReview', () => {
153125
});
154126
});
155127

156-
it('should setup the third response block for when the reviews are needed by', () => {
128+
it('should setup the second response block for when the reviews are needed by', () => {
157129
const { mock } = param.client.views.open as jest.Mock;
158130
const blocks = mock.calls[0][0].view.blocks;
159-
expect(blocks[2]).toEqual({
131+
expect(blocks[1]).toEqual({
160132
block_id: ActionId.REVIEW_DEADLINE,
161133
type: 'input',
162134
label: {
@@ -178,10 +150,10 @@ describe('requestReview', () => {
178150
});
179151
});
180152

181-
it('should setup the forth response block for the number of reviewers necessary', () => {
153+
it('should setup the third response block for the number of reviewers necessary', () => {
182154
const { mock } = param.client.views.open as jest.Mock;
183155
const blocks = mock.calls[0][0].view.blocks;
184-
expect(blocks[3]).toEqual({
156+
expect(blocks[2]).toEqual({
185157
block_id: ActionId.NUMBER_OF_REVIEWERS,
186158
type: 'input',
187159
label: {
@@ -200,13 +172,13 @@ describe('requestReview', () => {
200172
it('should default the number of reviewers to 2, the number required for a new hire', () => {
201173
const { mock } = param.client.views.open as jest.Mock;
202174
const blocks = mock.calls[0][0].view.blocks;
203-
expect(blocks[3].element.initial_value).toEqual('2');
175+
expect(blocks[2].element.initial_value).toEqual('2');
204176
});
205177

206-
it('should setup the sixth response block for the PDF file input', () => {
178+
it('should setup the fifth response block for the PDF file input', () => {
207179
const { mock } = param.client.views.open as jest.Mock;
208180
const blocks = mock.calls[0][0].view.blocks;
209-
expect(blocks[5]).toEqual({
181+
expect(blocks[4]).toEqual({
210182
type: 'input',
211183
block_id: ActionId.PDF_IDENTIFIER,
212184
label: {
@@ -222,19 +194,16 @@ describe('requestReview', () => {
222194
});
223195
});
224196

225-
it('should not setup the sixth response block for the PDF file input when HackParser is not enabled', async () => {
197+
it('should not setup the fifth response block for the PDF file input when HackParser is not enabled', async () => {
226198
process.env.HACK_PARSER_BUCKET_NAME = '';
227199

228200
languageRepo.listAll = jest.fn().mockResolvedValueOnce(['Javascript', 'Go', 'Other']);
229-
reviewTypesRepo.listAll = jest
230-
.fn()
231-
.mockResolvedValueOnce(['HackerRank', 'Moby Dick Project']);
232201

233202
await requestReview.shortcut(param);
234203

235204
const { mock } = param.client.views.open as jest.Mock;
236205
const blocks = mock.calls[1][0].view.blocks;
237-
expect(blocks[5]).toBeUndefined();
206+
expect(blocks[4]).toBeUndefined();
238207
});
239208
});
240209

@@ -265,7 +234,6 @@ describe('requestReview', () => {
265234
beforeEach(async () => {
266235
param.client.views.open = jest.fn().mockRejectedValueOnce('Dialog failed');
267236
languageRepo.listAll = jest.fn().mockResolvedValueOnce([]);
268-
reviewTypesRepo.listAll = jest.fn().mockResolvedValueOnce([]);
269237

270238
await requestReview.shortcut(param);
271239
});
@@ -313,15 +281,6 @@ describe('requestReview', () => {
313281
},
314282
},
315283
},
316-
[ActionId.REVIEW_TYPE]: {
317-
[ActionId.REVIEW_TYPE]: {
318-
type: 'static_select',
319-
selected_option: {
320-
text: { type: 'plain_text', text: 'Moby Dick Project' },
321-
value: 'Moby Dick Project',
322-
},
323-
},
324-
},
325284
[ActionId.NUMBER_OF_REVIEWERS]: {
326285
[ActionId.NUMBER_OF_REVIEWERS]: {
327286
type: 'plain_text_input',
@@ -400,7 +359,7 @@ describe('requestReview', () => {
400359
expect(param.client.chat.postMessage).toBeCalledWith({
401360
channel: 'some-channel-id',
402361
text: `
403-
<@${param.body.user.id}> has requested 1 reviews for a Moby Dick Project done in the following languages:
362+
<@${param.body.user.id}> has requested 1 reviews for a HackerRank done in the following languages:
404363
405364
• Go
406365
• Javascript
@@ -427,7 +386,6 @@ _Candidate Identifier: some-identifier_
427386
languages: ['Go', 'Javascript'],
428387
requestedAt: expect.any(Date),
429388
dueBy: Deadline.MONDAY,
430-
reviewType: 'Moby Dick Project',
431389
candidateIdentifier: 'some-identifier',
432390
reviewersNeededCount: '1',
433391
acceptedReviewers: [],

src/bot/enums.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export const enum ActionId {
2121
CANDIDATE_IDENTIFIER = 'candidate-identifier',
2222
REVIEWER_DM_ACCEPT = 'reviewer-dm-accept',
2323
REVIEWER_DM_DECLINE = 'reviewer-dm-deny',
24-
REVIEW_TYPE = 'review-type',
2524
PDF_IDENTIFIER = 'pdf-identifier',
2625
}
2726

src/bot/requestReview.ts

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { CallbackParam, ShortcutParam } from '@/slackTypes';
22
import { isViewSubmitActionParam } from '@/typeGuards';
33
import { activeReviewRepo } from '@repos/activeReviewsRepo';
44
import { languageRepo } from '@repos/languageRepo';
5-
import { reviewTypesRepo } from '@repos/reviewTypesRepo';
65
import { QueueService } from '@services';
76
import { App, Block, KnownBlock, PlainTextOption, View } from '@slack/bolt';
87
import { blockUtils } from '@utils/blocks';
@@ -28,21 +27,8 @@ export const requestReview = {
2827
app.view(Interaction.SUBMIT_REQUEST_REVIEW, this.callback.bind(this));
2928
},
3029

31-
dialog(languages: string[], reviewTypes: string[]): View {
30+
dialog(languages: string[]): View {
3231
const blocks: (Block | KnownBlock)[] = [
33-
{
34-
type: 'input',
35-
block_id: ActionId.REVIEW_TYPE,
36-
label: {
37-
text: 'What type of submission needs reviewed?',
38-
type: 'plain_text',
39-
},
40-
element: {
41-
type: 'static_select',
42-
action_id: ActionId.REVIEW_TYPE,
43-
options: buildReviewTypeOptions(reviewTypes),
44-
},
45-
},
4632
{
4733
type: 'input',
4834
block_id: ActionId.LANGUAGE_SELECTIONS,
@@ -146,11 +132,10 @@ export const requestReview = {
146132

147133
try {
148134
const languages = await languageRepo.listAll();
149-
const reviewTypes = await reviewTypesRepo.listAll();
150135

151136
await client.views.open({
152137
trigger_id: shortcut.trigger_id,
153-
view: this.dialog(languages, reviewTypes),
138+
view: this.dialog(languages),
154139
});
155140
// eslint-disable-next-line @typescript-eslint/no-explicit-any
156141
} catch (err: any) {
@@ -178,8 +163,6 @@ export const requestReview = {
178163
const deadline = blockUtils.getBlockValue(body, ActionId.REVIEW_DEADLINE);
179164
const numberOfReviewers = blockUtils.getBlockValue(body, ActionId.NUMBER_OF_REVIEWERS);
180165
const candidateIdentifier = blockUtils.getBlockValue(body, ActionId.CANDIDATE_IDENTIFIER);
181-
const reviewType = blockUtils.getBlockValue(body, ActionId.REVIEW_TYPE).selected_option.text
182-
.text;
183166

184167
let pdfIdentifier = '';
185168
// if HackParser is enabled AND the user uploaded a PDF file: download it from slack, and upload it to the HackParser S3 bucket
@@ -225,7 +208,7 @@ export const requestReview = {
225208
compose(
226209
`${mention(
227210
user,
228-
)} has requested ${numberOfReviewersValue} reviews for a ${reviewType} done in the following languages:`,
211+
)} has requested ${numberOfReviewersValue} reviews for a HackerRank done in the following languages:`,
229212
ul(...languages),
230213
bold(`The review is needed by end of day ${deadlineDisplay}`),
231214
candidateIdentifierValue ? italic(`Candidate Identifier: ${candidateIdentifierValue}`) : '',
@@ -263,7 +246,6 @@ export const requestReview = {
263246
{ id: user.id },
264247
languages,
265248
deadlineDisplay,
266-
reviewType,
267249
);
268250
const pendingReviewer: PendingReviewer = {
269251
userId: reviewer.id,
@@ -279,7 +261,6 @@ export const requestReview = {
279261
languages,
280262
requestedAt: new Date(),
281263
dueBy: deadlineValue,
282-
reviewType: reviewType,
283264
candidateIdentifier: candidateIdentifierValue,
284265
reviewersNeededCount: numberOfReviewersValue,
285266
acceptedReviewers: [],
@@ -301,12 +282,6 @@ function buildDeadlineOptions(): PlainTextOption[] {
301282
];
302283
}
303284

304-
function buildReviewTypeOptions(reviewTypes: string[]): PlainTextOption[] {
305-
return reviewTypes.map(reviewType => {
306-
return { text: { text: reviewType, type: 'plain_text' }, value: reviewType };
307-
});
308-
}
309-
310285
function buildOption(deadline: Deadline): PlainTextOption {
311286
return { text: { text: DeadlineLabel.get(deadline) || '', type: 'plain_text' }, value: deadline };
312287
}

src/cron/__tests__/reviewProcessor.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ function mockReview(pendingReviewers: PendingReviewer[]): ActiveReview {
1414
threadId: Math.random().toString(),
1515
acceptedReviewers: [],
1616
dueBy: Deadline.MONDAY,
17-
reviewType: 'HackerRank',
1817
candidateIdentifier: '',
1918
languages: [],
2019
pendingReviewers,

src/database/models/ActiveReview.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ export interface ActiveReview {
66
languages: string[];
77
requestedAt: Date;
88
dueBy: Deadline;
9-
reviewType: string;
109
candidateIdentifier: string;
1110
/**
1211
* The number of reviewers requested for this review. It should not change over the life of the

src/database/repos/activeReviewsRepo.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ enum Column {
99
LANGUAGES = 'languages',
1010
REQUESTED_AT = 'requestedAt',
1111
DUE_BY = 'dueBy',
12-
REVIEW_TYPE = 'reviewType',
1312
CANDIDATE_IDENTIFIER = 'candidateIdentifier',
1413
REVIEWERS_NEEDED_COUNT = 'reviewersNeededCount',
1514
ACCEPTED_REVIEWERS = 'acceptedReviewers',
@@ -33,7 +32,6 @@ function mapRowToActiveReview(row: GoogleSpreadsheetRow): ActiveReview {
3332
languages: row[Column.LANGUAGES].split(','),
3433
requestedAt: parseDateRow(row[Column.REQUESTED_AT]),
3534
dueBy: row[Column.DUE_BY],
36-
reviewType: row[Column.REVIEW_TYPE],
3735
candidateIdentifier: row[Column.CANDIDATE_IDENTIFIER],
3836
reviewersNeededCount: Number(row[Column.REVIEWERS_NEEDED_COUNT]),
3937
acceptedReviewers: JSON.parse(row[Column.ACCEPTED_REVIEWERS]),
@@ -51,7 +49,6 @@ function mapActiveReviewToRow(activeReview: ActiveReview): Record<string, any> {
5149
[Column.LANGUAGES]: activeReview.languages.join(','),
5250
[Column.REQUESTED_AT]: activeReview.requestedAt.getTime(),
5351
[Column.DUE_BY]: activeReview.dueBy,
54-
[Column.REVIEW_TYPE]: activeReview.reviewType,
5552
[Column.CANDIDATE_IDENTIFIER]: activeReview.candidateIdentifier,
5653
[Column.REVIEWERS_NEEDED_COUNT]: activeReview.reviewersNeededCount,
5754
[Column.ACCEPTED_REVIEWERS]: JSON.stringify(activeReview.acceptedReviewers),

src/database/repos/reviewTypesRepo.ts

Lines changed: 0 additions & 34 deletions
This file was deleted.

src/services/ChatService.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,13 @@ export const chatService = {
9090
requestor: { id: string },
9191
languages: string[],
9292
deadlineDisplay: string,
93-
reviewType: string,
9493
): Promise<string> {
9594
const request = requestBuilder.buildReviewRequest(
9695
reviewerId,
9796
threadId,
9897
requestor,
9998
languages,
10099
deadlineDisplay,
101-
reviewType,
102100
);
103101
const requestWithToken = {
104102
...request,

src/services/RequestService.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ function moveOntoNextPerson(closeMessage: string) {
5050
{ id: updatedReview.requestorId },
5151
updatedReview.languages,
5252
DeadlineLabel.get(updatedReview.dueBy) || 'Unknown',
53-
updatedReview.reviewType,
5453
);
5554
const closeMessageBlock = textBlock(closeMessage);
5655
await chatService.updateDirectMessage(
@@ -81,7 +80,6 @@ async function requestNextUserReview(review: ActiveReview, _client: WebClient):
8180
{ id: review.requestorId },
8281
review.languages,
8382
DeadlineLabel.get(review.dueBy) || '',
84-
review.reviewType,
8583
);
8684
const pendingReviewer: PendingReviewer = {
8785
...nextUser,

0 commit comments

Comments
 (0)