mirror of
https://github.com/bakhirev/assayo.git
synced 2024-11-16 08:11:40 +00:00
update
This commit is contained in:
parent
02e110fbc0
commit
11f80e167e
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@ const PROPERTIES = [
|
||||||
{ property: 'daysWorked', sort: 1 },
|
{ property: 'daysWorked', sort: 1 },
|
||||||
{ property: 'daysLosses', sort: -1 },
|
{ property: 'daysLosses', sort: -1 },
|
||||||
{ property: 'commits', sort: 1 },
|
{ property: 'commits', sort: 1 },
|
||||||
{ property: 'tasks', sort: 1 },
|
{ property: 'tasks', sort: 1, isNeedTasks: true },
|
||||||
{ property: 'moneyAll', sort: 1 },
|
{ property: 'moneyAll', sort: 1 },
|
||||||
{ property: 'moneyWorked', sort: 1 },
|
{ property: 'moneyWorked', sort: 1 },
|
||||||
{ property: 'moneyLosses', sort: -1 },
|
{ property: 'moneyLosses', sort: -1 },
|
||||||
|
@ -12,21 +12,25 @@ const PROPERTIES = [
|
||||||
{
|
{
|
||||||
property: 'daysForTask',
|
property: 'daysForTask',
|
||||||
sort: -1,
|
sort: -1,
|
||||||
formatter: (user: any) => user.daysForTask && user.tasks.length ? user.daysForTask : Infinity,
|
isNeedTasks: true,
|
||||||
|
formatter: (user: any) => user.daysForTask,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: 'commitsForTask',
|
property: 'commitsForTask',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
formatter: (user: any) => user.tasks.length ? (user.commits / user.tasks.length) : Infinity,
|
isNeedTasks: true,
|
||||||
|
formatter: (user: any) => user.commits / user.tasks.length,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: 'linesForTask',
|
property: 'linesForTask',
|
||||||
sort: -1,
|
sort: -1,
|
||||||
formatter: (user: any) => user.tasks.length ? user.changesForTask : Infinity,
|
isNeedTasks: true,
|
||||||
|
formatter: (user: any) => user.changesForTask,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
property: 'speedMaxTasks',
|
property: 'speedMaxTasks',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
|
isNeedTasks: true,
|
||||||
formatter: (user: any, timestamp: any) => timestamp.tasksByTimestampCounter.max,
|
formatter: (user: any, timestamp: any) => timestamp.tasksByTimestampCounter.max,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -37,6 +41,7 @@ const PROPERTIES = [
|
||||||
{
|
{
|
||||||
property: 'moneyForTask',
|
property: 'moneyForTask',
|
||||||
sort: 1,
|
sort: 1,
|
||||||
|
isNeedTasks: true,
|
||||||
formatter: (user: any) => user.moneyWorked / user.tasks.length,
|
formatter: (user: any) => user.moneyWorked / user.tasks.length,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -46,19 +51,23 @@ const PROPERTIES = [
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function getValue(config: any, user: any, dataGripByTimestamp: any) {
|
function getValues(config: any, dataGripByTimestamp: any) {
|
||||||
const timestamp = dataGripByTimestamp.statisticByAuthor[user.author];
|
return (user: any) => {
|
||||||
if (config.formatter) {
|
const timestamp = dataGripByTimestamp.statisticByAuthor[user.author];
|
||||||
return config.formatter(user, timestamp);
|
if (config.isNeedTasks && !user.tasks.length) return NaN;
|
||||||
}
|
|
||||||
|
|
||||||
const value = user[config.property]
|
if (config.formatter) {
|
||||||
|| timestamp[config.property]
|
return config.formatter(user, timestamp);
|
||||||
|| 0;
|
}
|
||||||
|
|
||||||
return Array.isArray(value)
|
const value = user[config.property]
|
||||||
? value?.length
|
|| timestamp[config.property]
|
||||||
: value;
|
|| 0;
|
||||||
|
|
||||||
|
return Array.isArray(value)
|
||||||
|
? value?.length
|
||||||
|
: value;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class DataGripByScoring {
|
export default class DataGripByScoring {
|
||||||
|
@ -83,7 +92,10 @@ export default class DataGripByScoring {
|
||||||
});
|
});
|
||||||
|
|
||||||
PROPERTIES.forEach((config: any) => {
|
PROPERTIES.forEach((config: any) => {
|
||||||
const values = list.map((user: any) => getValue(config, user, dataGripByTimestamp));
|
const getValue = getValues(config, dataGripByTimestamp);
|
||||||
|
const values = list
|
||||||
|
.map(getValue)
|
||||||
|
.filter((value: number) => !isNaN(value));
|
||||||
|
|
||||||
const uniqValues = Array.from(new Set(values));
|
const uniqValues = Array.from(new Set(values));
|
||||||
const places = uniqValues
|
const places = uniqValues
|
||||||
|
|
36
src/ts/pages/Settings/components/CommitFilters.tsx
Normal file
36
src/ts/pages/Settings/components/CommitFilters.tsx
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
import React from 'react';
|
||||||
|
import { observer } from 'mobx-react-lite';
|
||||||
|
|
||||||
|
import InputString from 'ts/components/UiKit/components/InputString';
|
||||||
|
import PageBox from 'ts/components/Page/Box';
|
||||||
|
import Title from 'ts/components/Title';
|
||||||
|
|
||||||
|
import formStore from '../store/Form';
|
||||||
|
|
||||||
|
const CommitFilters = observer((): React.ReactElement | null => {
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<Title title="page.settings.commitFilters.title"/>
|
||||||
|
<PageBox>
|
||||||
|
<InputString
|
||||||
|
title="page.settings.commitFilters.author"
|
||||||
|
value={formStore.state?.commitFilters?.author}
|
||||||
|
placeholder=""
|
||||||
|
onChange={(value: string) => {
|
||||||
|
formStore.updateState('commitFilters.author', value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
<InputString
|
||||||
|
title="page.settings.commitFilters.message"
|
||||||
|
value={formStore.state?.commitFilters?.message}
|
||||||
|
placeholder=""
|
||||||
|
onChange={(value: string) => {
|
||||||
|
formStore.updateState('commitFilters.message', value);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</PageBox>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
export default CommitFilters;
|
|
@ -63,6 +63,10 @@ export default function getEmptySettings(): IUserSetting {
|
||||||
pr: 'https://bitbucket.com/projects/assayo/repos/frontend/pull-requests/',
|
pr: 'https://bitbucket.com/projects/assayo/repos/frontend/pull-requests/',
|
||||||
// https://gitlab.com/___/___/-/merge_requests/100500
|
// https://gitlab.com/___/___/-/merge_requests/100500
|
||||||
},
|
},
|
||||||
|
// commitFilters: {
|
||||||
|
// author: '',
|
||||||
|
// message: '',
|
||||||
|
// },
|
||||||
employees: [],
|
employees: [],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import splashScreenStore from 'ts/components/SplashScreen/store';
|
||||||
import { applicationHasCustom } from 'ts/helpers/RPC';
|
import { applicationHasCustom } from 'ts/helpers/RPC';
|
||||||
import Depersonalized from 'ts/helpers/Depersonalized';
|
import Depersonalized from 'ts/helpers/Depersonalized';
|
||||||
|
|
||||||
|
import userSettingsStore from './UserSettings';
|
||||||
import filtersInHeaderStore from './FiltersInHeader';
|
import filtersInHeaderStore from './FiltersInHeader';
|
||||||
import viewNameStore, { ViewNameEnum } from './ViewName';
|
import viewNameStore, { ViewNameEnum } from './ViewName';
|
||||||
|
|
||||||
|
@ -105,13 +106,15 @@ class DataGripStore {
|
||||||
dataGrip.clear();
|
dataGrip.clear();
|
||||||
fileGrip.clear();
|
fileGrip.clear();
|
||||||
|
|
||||||
|
// const message = userSettingsStore.settings?.commitFilters?.message || '';
|
||||||
|
// const messageCheck = message ? new RegExp(message) : null;
|
||||||
|
|
||||||
const depersonalized = new Depersonalized();
|
const depersonalized = new Depersonalized();
|
||||||
this.commits.forEach((commit: ICommit | ISystemCommit) => {
|
this.commits.forEach((commit: ICommit | ISystemCommit) => {
|
||||||
if (commit.timestamp < filtersInHeaderStore.from
|
if (commit.timestamp < filtersInHeaderStore.from
|
||||||
|| commit.timestamp > filtersInHeaderStore.to) return;
|
|| commit.timestamp > filtersInHeaderStore.to) return;
|
||||||
|
|
||||||
// if ((commit.message || '').indexOf('Deploying') !== -1) return;
|
// if (messageCheck && messageCheck.test(commit.message || '')) return;
|
||||||
// if ((commit.message || '').indexOf('Deployed') !== -1) return;
|
|
||||||
|
|
||||||
const localCommit = this.isDepersonalized
|
const localCommit = this.isDepersonalized
|
||||||
? depersonalized.getCommit(commit)
|
? depersonalized.getCommit(commit)
|
||||||
|
|
Loading…
Reference in a new issue