Skip to content

Commit eb32f2d

Browse files
authored
rendering refactor
1 parent 095a48f commit eb32f2d

25 files changed

+307
-75
lines changed

TODO.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,16 @@
3434
- 🔮 Sorecer - knew how the sprint will end
3535
- 🖊️ Writer - most of docs written
3636

37+
- 🧨 Flooded sprint
38+
3739
<!--
3840
🧊 🏋️ 💤 🏓 ✈️ 🛸 🪐 ⛱️ 🔔 📢 📣 🍾 🌊 💨 🍄 🌝 🌪️ ❄️ ☂️
3941
💧 🐽 🐷 🐾 👣 🐙 🌎 ☁️ ☄️ 🤗 🧠 🦴 👃 👂 🧚 🧞 🧟 🧘 🧳
4042
🎃 👑 💼 ⛑️ 🧴 😎 🚿 💆 🛀 🦠 ✨ 🏖️ 🗑️ 🎰 🎱 🎲 🔮 🗄️ 🖇️
4143
🛢️ 🧹 🛀 🧲 🔋 🧭 🔦 ⚙️ ⚡ 🤖 🔧 💳 🔌 🔎 📷 🔬 🕵️ 🔭 👽
4244
🧑‍🚀 🛰️ 📡 🥛 🎂 🧀 🍕 🧰 👷 🚧 🎥 🎬 💩 🎉 📚 ⛄ 🧸 👋 🏆
43-
⚽ 🥅 🤓 🧐 🍭 🍭 🎪 🗡️ 🐉 🧝 🃏 🎲 🧩 🙈 🖊️ 🏛️ 🗝️ 🗺️ 🙉
45+
⚽ 🥅 🤓 🧐 🍭 🎪 🗡️ 🐉 🧝 🃏 🎲 🧩 🙈 🖊️ 🏛️ 🗝️ 🗺️ 🙉 🤯
46+
💬 📰 🚨 ☕ 🌋
4447
-->
4548

4649
- Web Experience team ["legomushroom", "plisy", "GideonCheruiyot", "VincentDondain", "wachaudh", "klvnraju"]

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@
3131
"@actions/core": "^1.2.6",
3232
"@actions/github": "^4.0.0",
3333
"dotenv": "^8.2.0",
34+
"moment": "^2.29.1",
3435
"shortid": "^2.2.16"
3536
},
3637
"devDependencies": {
3738
"@types/jest": "^26.0.10",
39+
"@types/moment": "^2.13.0",
3840
"@types/node": "^14.10.0",
3941
"@types/shortid": "^0.0.29",
4042
"@typescript-eslint/parser": "^3.10.1",

sprint178Config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[
22
{
33
"$schema": "https://gist.githubusercontent.com/legomushroom/e997b3c9f15e647a2c62e5414c68deba/raw/1032960ca348ea3aa1399f17d304570720f27a49/botspaces-config-schema.json",
4+
"sprintStartDate": "2020-10-19",
45
"sprintDuration": 21,
56
"sprintNumberHolidays": 0,
6-
"sprintStartDate": "2020-10-19",
77
"boardIssue": "https://github.com/microsoft/vssaas-planning/issues/1109",
88
"repos": [
99
{
@@ -18,6 +18,7 @@
1818
"serverless",
1919
"performance"
2020
],
21+
"priorityLabels": ["p0", "p1"],
2122
"isCheckListItems": true
2223
}
2324
]

src/interfaces/ICardWithIssue.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ export interface ICardWithIssue {
66
column: TColumnTypes;
77
issue?: TRepoIssue;
88
card: TColumnCard;
9+
isNew: boolean;
910
}

src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const processConfigRecord = async (
8989
for (let { repo, projects } of repoProjects) {
9090
const projectsWithData = await Promise.all(
9191
projects.map(async (project) => {
92-
const data = await getProjectData(projectKit, repo, project);
92+
const data = await getProjectData(projectKit, config, project);
9393
return {
9494
project,
9595
data,

src/octokit/ProjectsOctoKit.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ import { TProjectColumn } from '../interfaces/TProjectColumn';
1515
import { flattenArray } from '../utils/flatternArray';
1616
import { IParsedRepo } from '../interfaces/IParsedRepo';
1717
import { ICardWithIssue } from '../interfaces/ICardWithIssue';
18+
import { IConfig } from '../interfaces/IConfig';
19+
import { isNewCard } from '../utils/isNewCard';
1820

1921
interface IColumnWithCards {
2022
column: TProjectColumn;
@@ -244,6 +246,7 @@ export class ProjectsOctoKit extends OctoKitBase {
244246
issues: TRepoIssue[],
245247
columns: TColumnsWithCardsMap,
246248
columnType: TColumnTypes,
249+
config: IConfig,
247250
): ICardWithIssue[] => {
248251
// get the column
249252
const column = columns[columnType];
@@ -263,6 +266,7 @@ export class ProjectsOctoKit extends OctoKitBase {
263266
card,
264267
issue: cardIssue,
265268
column: columnType,
269+
isNew: isNewCard(card, config),
266270
}
267271
});
268272

src/utils/filterPlannedProjectData.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import { IProjectData } from '../interfaces/IProjectData';
2+
import { ICardWithIssue } from '../interfaces/ICardWithIssue';
3+
4+
const filterNewCards = (cardsWithIssue: ICardWithIssue[]): ICardWithIssue[] => {
5+
return cardsWithIssue.filter((card) => {
6+
return !card.isNew;
7+
});
8+
};
9+
10+
export const filterPlannedProjectData = (data: IProjectData): IProjectData => {
11+
12+
return {
13+
...data,
14+
// combined
15+
inWorkIssues: filterNewCards(data.inWorkIssues),
16+
doneOrDeployIssues: filterNewCards(data.doneOrDeployIssues),
17+
allPlannedIssues: filterNewCards(data.allPlannedIssues),
18+
issuesToSolve: filterNewCards(data.issuesToSolve),
19+
// plain
20+
backlogIssues: filterNewCards(data.backlogIssues),
21+
committedIssues: filterNewCards(data.committedIssues),
22+
progressIssues: filterNewCards(data.progressIssues),
23+
inReviewIssues: filterNewCards(data.inReviewIssues),
24+
blockedIssues: filterNewCards(data.blockedIssues),
25+
waitingToDeployIssues: filterNewCards(data.waitingToDeployIssues),
26+
doneIssues: filterNewCards(data.doneIssues),
27+
};
28+
};

src/utils/functional/curry.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
type TFunction<K extends any[]> = (...args: K) => any;
2+
3+
4+
// type VariadicCurry<T, R> =
5+
// T extends [any, any, any, any] ? Curry4<T[0], T[1], T[2], T[3], R> :
6+
// T extends [any, any, any] ? Curry3<T[0], T[1], T[2], R> :
7+
// T extends [any, any] ? Curry2<T[0], T[1], R> :
8+
// T extends [any] ? Curry1<T[0], R> :
9+
// unknown
10+
// ;
11+
12+
// declare function curry<T extends any[], R>
13+
// (fn: (...args: T) => R): VariadicCurry<T, R>;
14+
15+
// export const curry = <T extends any[], R>(fun: TFunction<T>, ...args: R) => {
16+
// return <P extends any[]>(...args2: P): ReturnType<TFunction<T>> => {
17+
// return fun(...args, ...args2);
18+
// }
19+
// };

src/utils/functional/not.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
type TFunction<K extends any[]> = (...args: K) => any;
3+
type TWrappedFunction<K extends any[]> = (...args: K) => boolean;
4+
5+
export const not = <T extends any[]>(fun: TFunction<T>): TWrappedFunction<T> => {
6+
return (...args: T): boolean => {
7+
return !fun(...args);
8+
}
9+
};

src/utils/getProjectData.ts

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { ProjectsOctoKit } from '../octokit/ProjectsOctoKit';
22
import { measure } from './measure';
33

44
import { TColumnTypes } from '../interfaces/TColumnTypes';
5-
import { IRepoSourceConfig } from '../interfaces/IRepoSourceConfig';
65
import { IProjectData } from '../interfaces/IProjectData';
76
import { IProjectWithConfig } from '../interfaces/IProjectWithConfig';
7+
import { IConfig } from '../interfaces/IConfig';
88

99
export const getProjectData = async (
1010
projectKit: ProjectsOctoKit,
11-
repo: IRepoSourceConfig,
11+
config: IConfig,
1212
project: IProjectWithConfig,
1313
): Promise<IProjectData> => {
1414
return await measure(`Get data for the "${project.project.name}" project`, async () => {
@@ -33,48 +33,55 @@ export const getProjectData = async (
3333
issues,
3434
cards,
3535
TColumnTypes.Backlog,
36+
config,
3637
);
3738
console.log(`BacklogIssues: ${backlogIssues.length} items`);
3839

3940
const committedIssues = await projectKit.mergeCardsWithIssuesForColumn(
4041
issues,
4142
cards,
4243
TColumnTypes.Committed,
44+
config,
4345
);
4446
console.log(`CommittedIssues: ${committedIssues.length} items`);
4547

4648
const blockedIssues = await projectKit.mergeCardsWithIssuesForColumn(
4749
issues,
4850
cards,
49-
TColumnTypes.Blocked
51+
TColumnTypes.Blocked,
52+
config,
5053
);
5154
console.log(`BlockedIssues: ${blockedIssues.length} items`);
5255

5356
const progressIssues = await projectKit.mergeCardsWithIssuesForColumn(
5457
issues,
5558
cards,
56-
TColumnTypes.InProgress
59+
TColumnTypes.InProgress,
60+
config,
5761
);
5862
console.log(`ProgressIssues: ${progressIssues.length} items`);
5963

6064
const inReviewIssues = await projectKit.mergeCardsWithIssuesForColumn(
6165
issues,
6266
cards,
63-
TColumnTypes.InReview
67+
TColumnTypes.InReview,
68+
config,
6469
);
6570
console.log(`InReviewIssues: ${inReviewIssues.length} items`);
6671

6772
const waitingToDeployIssues = await projectKit.mergeCardsWithIssuesForColumn(
6873
issues,
6974
cards,
70-
TColumnTypes.WaitingToDeploy
75+
TColumnTypes.WaitingToDeploy,
76+
config,
7177
);
7278
console.log(`WaitingToDeployIssues: ${waitingToDeployIssues.length} items`);
7379

7480
const doneIssues = await projectKit.mergeCardsWithIssuesForColumn(
7581
issues,
7682
cards,
77-
TColumnTypes.Done
83+
TColumnTypes.Done,
84+
config,
7885
);
7986
console.log(`doneIssues: ${doneIssues.length} items`);
8087

@@ -101,3 +108,4 @@ export const getProjectData = async (
101108
};
102109
});
103110
};
111+

0 commit comments

Comments
 (0)