fix(plugins/base): job availability status (#1081)
This commit is contained in:
@@ -105,7 +105,7 @@
|
||||
createdAt: `${faker.date.past(10)}`,
|
||||
avatarUrl: set.avatar,
|
||||
websiteUrl: options["pagespeed.url"] || "(attached website)",
|
||||
isHireable: false,
|
||||
isHireable: options["base.hireable"],
|
||||
twitterUsername: options["tweets.user"] || "(attached Twitter account)",
|
||||
repositories: {totalCount: faker.datatype.number(100), totalDiskUsage: faker.datatype.number(100000), nodes: []},
|
||||
packages: {totalCount: faker.datatype.number(10)},
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
export default async function({login, graphql, rest, data, q, queries, imports}, conf) {
|
||||
//Load inputs
|
||||
console.debug(`metrics/compute/${login}/base > started`)
|
||||
let {indepth, "repositories.forks": _forks, "repositories.affiliations": _affiliations, "repositories.batch": _batch} = imports.metadata.plugins.base.inputs({data, q, account: "bypass"})
|
||||
let {indepth, hireable, "repositories.forks": _forks, "repositories.affiliations": _affiliations, "repositories.batch": _batch} = imports.metadata.plugins.base.inputs({data, q, account: "bypass"})
|
||||
const extras = conf.settings.extras?.features ?? conf.settings.extras?.default
|
||||
const repositories = conf.settings.repositories || 100
|
||||
const forks = _forks ? "" : ", isFork: false"
|
||||
@@ -134,6 +134,11 @@ export default async function({login, graphql, rest, data, q, queries, imports},
|
||||
console.debug(`metrics/compute/${login}/base > falling back to last year commits history`)
|
||||
}
|
||||
}
|
||||
//Hireable status
|
||||
if (hireable) {
|
||||
console.debug(`metrics/compute/${login}/base > is hireable`)
|
||||
data.user.isHireable = hireable
|
||||
}
|
||||
}
|
||||
//Query repositories from GitHub API
|
||||
for (const type of ({user: ["repositories", "repositoriesContributedTo"], organization: ["repositories"]}[account] ?? [])) {
|
||||
@@ -213,6 +218,7 @@ const postprocess = {
|
||||
console.debug(`metrics/compute/${login}/base > applying postprocessing`)
|
||||
data.account = "user"
|
||||
Object.assign(data.user, {
|
||||
isHireable: false,
|
||||
isVerified: false,
|
||||
repositories: {},
|
||||
contributionsCollection: {},
|
||||
|
||||
@@ -50,6 +50,12 @@ inputs:
|
||||
type: boolean
|
||||
default: no
|
||||
|
||||
base_hireable:
|
||||
description: |
|
||||
Display `Available for hire!` in header section
|
||||
type: boolean
|
||||
default: no
|
||||
|
||||
repositories:
|
||||
description: |
|
||||
Repositories to fetch
|
||||
|
||||
@@ -7,7 +7,6 @@ query BaseUser {
|
||||
createdAt
|
||||
avatarUrl
|
||||
websiteUrl
|
||||
isHireable
|
||||
twitterUsername
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,10 +139,6 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q
|
||||
console.debug(`metrics/compute/${login} > applying dflag --cakeday`)
|
||||
computed.cakeday = true
|
||||
}
|
||||
if (dflags.includes("--hireable")) {
|
||||
console.debug(`metrics/compute/${login} > applying dflag --hireable`)
|
||||
data.user.isHireable = true
|
||||
}
|
||||
if (dflags.includes("--halloween")) {
|
||||
console.debug(`metrics/compute/${login} > applying dflag --halloween`)
|
||||
//Haloween color replacer
|
||||
|
||||
@@ -467,7 +467,6 @@ inputs:
|
||||
description: |
|
||||
Debug flags
|
||||
- `--cakeday`: simulate registration anniversary
|
||||
- `--hireable`: simulate "Available for hire" account setting
|
||||
- `--halloween`: enable halloween colors
|
||||
- `--error`: force render error
|
||||
type: array
|
||||
@@ -475,7 +474,6 @@ inputs:
|
||||
default: ""
|
||||
values:
|
||||
- --cakeday
|
||||
- --hireable
|
||||
- --halloween
|
||||
- --error
|
||||
testing: yes
|
||||
|
||||
@@ -9,7 +9,6 @@ export default function({faker, query, login = faker.internet.userName()}) {
|
||||
createdAt: `${faker.date.past(10)}`,
|
||||
avatarUrl: faker.image.people(),
|
||||
websiteUrl: faker.internet.url(),
|
||||
isHireable: faker.datatype.boolean(),
|
||||
twitterUsername: login,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user