Fix work items date rendering

This commit is contained in:
Garrett Mills 2022-05-05 20:57:30 -05:00
parent e3c3b93818
commit 14dc9c2447
4 changed files with 26 additions and 16 deletions

8
.idea/misc.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="SwUserDefinedSpecifications">
<option name="specTypeByUrl">
<map />
</option>
</component>
</project>

View File

@ -8,7 +8,7 @@
"lib": "lib" "lib": "lib"
}, },
"dependencies": { "dependencies": {
"@extollo/lib": "^0.9.32", "@extollo/lib": "^0.9.43",
"copyfiles": "^2.4.1", "copyfiles": "^2.4.1",
"feed": "^4.2.2", "feed": "^4.2.2",
"gotify": "^1.1.0", "gotify": "^1.1.0",
@ -23,7 +23,9 @@
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"build": "excc -c package.json -t tsconfig.json", "build": "excc -c package.json -t tsconfig.json",
"app": "pnpm run build && node lib/index.js", "app": "pnpm run build && node lib/index.js",
"cli": "pnpm run build && node lib/cli.js" "cli": "pnpm run build && node lib/cli.js",
"docker:build": "docker build -t ${DOCKER_REGISTRY}/garrettmills/www .",
"docker:push": "docker push ${DOCKER_REGISTRY}/garrettmills/www"
}, },
"files": [ "files": [
"lib/**/*" "lib/**/*"

View File

@ -2,7 +2,7 @@ lockfileVersion: 5.3
specifiers: specifiers:
'@extollo/cc': ^0.6.0 '@extollo/cc': ^0.6.0
'@extollo/lib': ^0.9.32 '@extollo/lib': ^0.9.43
copyfiles: ^2.4.1 copyfiles: ^2.4.1
feed: ^4.2.2 feed: ^4.2.2
gotify: ^1.1.0 gotify: ^1.1.0
@ -14,7 +14,7 @@ specifiers:
zod: ^3.11.6 zod: ^3.11.6
dependencies: dependencies:
'@extollo/lib': 0.9.32 '@extollo/lib': 0.9.43
copyfiles: 2.4.1 copyfiles: 2.4.1
feed: 4.2.2 feed: 4.2.2
gotify: 1.1.0 gotify: 1.1.0
@ -114,8 +114,8 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@extollo/lib/0.9.32: /@extollo/lib/0.9.43:
resolution: {integrity: sha512-3DuRrLFmYY6w0rK5QKSlNWbGZnel6Lj2vjSGwwbj1IEJXGcZSA+TMXLghAwPkKyUsyX0WwdXVn6S51jmRHyWJw==} resolution: {integrity: sha512-gsoP/q638AiMdMe9AReiuEqibm5Y6jMVQbmICOgAPZRLJWTiuc5+puEHUWyuvBcuP0w8YxNS+Vn/hZeF/EECLQ==}
dependencies: dependencies:
'@atao60/fse-cli': 0.1.7 '@atao60/fse-cli': 0.1.7
'@extollo/ui': 0.1.0_@types+node@14.18.12 '@extollo/ui': 0.1.0_@types+node@14.18.12
@ -1278,7 +1278,7 @@ packages:
source-map: 0.6.1 source-map: 0.6.1
wordwrap: 1.0.0 wordwrap: 1.0.0
optionalDependencies: optionalDependencies:
uglify-js: 3.15.3 uglify-js: 3.15.4
dev: false dev: false
/has-flag/4.0.0: /has-flag/4.0.0:
@ -2690,8 +2690,8 @@ packages:
engines: {node: '>=4.2.0'} engines: {node: '>=4.2.0'}
hasBin: true hasBin: true
/uglify-js/3.15.3: /uglify-js/3.15.4:
resolution: {integrity: sha512-6iCVm2omGJbsu3JWac+p6kUiOpg3wFO2f8lIXjfEb8RrmLjzog1wTPMmwKB7swfzzqxj9YM+sGUM++u1qN4qJg==} resolution: {integrity: sha512-vMOPGDuvXecPs34V74qDKk4iJ/SN4vL3Ow/23ixafENYvtrNvtbcgUeugTcUGRGsOF/5fU8/NYSL5Hyb3l1OJA==}
engines: {node: '>=0.8.0'} engines: {node: '>=0.8.0'}
hasBin: true hasBin: true
requiresBuild: true requiresBuild: true

View File

@ -35,16 +35,16 @@ export class Home extends Controller {
public async welcome(feedPosts: Collection<FeedPost>) { public async welcome(feedPosts: Collection<FeedPost>) {
const workItems = await this.getWorkItems() const workItems = await this.getWorkItems()
const workItemYears = workItems.map(item => item.startDate.getFullYear()).unique()
const workItemVisibleYears = workItems.filter(item => !item.endDate)
.map(item => item.startDate.getFullYear())
.unique()
return view('welcome', { return view('welcome', {
feedPosts: feedPosts.toArray(), feedPosts: feedPosts.toArray(),
workItemGroups: workItems.groupBy(item => item.startDate.getFullYear()), workItemGroups: workItems.groupBy(item => item.startDate.getFullYear()),
workItemYears: workItems.map(item => item.startDate.getFullYear()) workItemYears: workItemYears.toArray(),
.unique() workItemHiddenYears: workItemYears.diff(workItemVisibleYears)
.toArray(),
workItemHiddenYears: workItems.filter(item => item.endDate)
.map(item => item.startDate.getFullYear())
.unique()
.toArray()
}) })
} }