Skip to content

Commit

Permalink
add ignore flag (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ttymsd authored Nov 18, 2021
1 parent ed586fb commit bbfdd98
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 9 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ function findWrikeTasks(config, issues) {
params: {
"pageSize": 20,
"nextPageToken": null,
"fields": '["customFields"]',
"customField": {
"id": config.crashlyticsIssueIdFieldId,
"comparator": "EqualTo",
Expand Down Expand Up @@ -219,13 +220,19 @@ function registerWrike(config, issues) {
case 1:
tasks = _a.sent();
return [2 /*return*/, Promise.all(tasks.map(function (tasks, index) { return __awaiter(_this, void 0, void 0, function () {
var task, res;
var task, customFilelds, fixedOrIgnore, regression, res;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
task = tasks[0];
if (!task) return [3 /*break*/, 3];
if (!(config.wrikeConfig.notCompletedWorkflowStatusIds.indexOf(task.customStatusId) == -1)) return [3 /*break*/, 2];
customFilelds = task.customFields.reduce(function (acc, v, _) {
acc[v.id] = v.value;
return acc;
}, {});
fixedOrIgnore = customFilelds[config.wrikeConfig.fixedOrIgnoreFlagFieldId] == "true";
regression = config.wrikeConfig.notCompletedWorkflowStatusIds.indexOf(task.customStatusId) == -1;
if (!(!fixedOrIgnore && regression)) return [3 /*break*/, 2];
return [4 /*yield*/, toTodoStatusWrikeTask(config.wrikeConfig, task)];
case 1:
res = _a.sent();
Expand Down
11 changes: 10 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ interface WrikeConfig {
notCompletedWorkflowStatusIds: Array<string>;
crashlyticsIssueIdFieldId: string;
todoWorkflowStatusId: string;
fixedOrIgnoreFlagFieldId: string;
}

interface CrashlyticsConfig {
Expand Down Expand Up @@ -152,6 +153,7 @@ async function findWrikeTasks(config: WrikeConfig, issues: Array<CrashlyticsIssu
params: {
"pageSize": 20,
"nextPageToken": null,
"fields": '["customFields"]',
"customField": {
"id": config.crashlyticsIssueIdFieldId,
"comparator": "EqualTo",
Expand Down Expand Up @@ -196,8 +198,15 @@ async function registerWrike(config: CrashlyticsAnalysisConfig, issues: Array<Cr
// issueIdに紐づくtaskは基本一つ
const task = tasks[0];
if (task) {
// 修正済み/無視することにしたtaskは更新しない
const customFilelds = task.customFields.reduce((acc: any, v: any, _: any) => {
acc[v.id] = v.value
return acc
}, {});
const fixedOrIgnore = customFilelds[config.wrikeConfig.fixedOrIgnoreFlagFieldId] == "true"
const regression = config.wrikeConfig.notCompletedWorkflowStatusIds.indexOf(task.customStatusId) == -1
// Todoで上書きするようにする
if (config.wrikeConfig.notCompletedWorkflowStatusIds.indexOf(task.customStatusId) == -1) {
if (!fixedOrIgnore && regression) {
const res = await toTodoStatusWrikeTask(config.wrikeConfig, task);
}
} else {
Expand Down

0 comments on commit bbfdd98

Please sign in to comment.