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: 'daysLosses', sort: -1 },
|
||||
{ property: 'commits', sort: 1 },
|
||||
{ property: 'tasks', sort: 1 },
|
||||
{ property: 'tasks', sort: 1, isNeedTasks: true },
|
||||
{ property: 'moneyAll', sort: 1 },
|
||||
{ property: 'moneyWorked', sort: 1 },
|
||||
{ property: 'moneyLosses', sort: -1 },
|
||||
|
@ -12,21 +12,25 @@ const PROPERTIES = [
|
|||
{
|
||||
property: 'daysForTask',
|
||||
sort: -1,
|
||||
formatter: (user: any) => user.daysForTask && user.tasks.length ? user.daysForTask : Infinity,
|
||||
isNeedTasks: true,
|
||||
formatter: (user: any) => user.daysForTask,
|
||||
},
|
||||
{
|
||||
property: 'commitsForTask',
|
||||
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',
|
||||
sort: -1,
|
||||
formatter: (user: any) => user.tasks.length ? user.changesForTask : Infinity,
|
||||
isNeedTasks: true,
|
||||
formatter: (user: any) => user.changesForTask,
|
||||
},
|
||||
{
|
||||
property: 'speedMaxTasks',
|
||||
sort: 1,
|
||||
isNeedTasks: true,
|
||||
formatter: (user: any, timestamp: any) => timestamp.tasksByTimestampCounter.max,
|
||||
},
|
||||
{
|
||||
|
@ -37,6 +41,7 @@ const PROPERTIES = [
|
|||
{
|
||||
property: 'moneyForTask',
|
||||
sort: 1,
|
||||
isNeedTasks: true,
|
||||
formatter: (user: any) => user.moneyWorked / user.tasks.length,
|
||||
},
|
||||
{
|
||||
|
@ -46,8 +51,11 @@ const PROPERTIES = [
|
|||
},
|
||||
];
|
||||
|
||||
function getValue(config: any, user: any, dataGripByTimestamp: any) {
|
||||
function getValues(config: any, dataGripByTimestamp: any) {
|
||||
return (user: any) => {
|
||||
const timestamp = dataGripByTimestamp.statisticByAuthor[user.author];
|
||||
if (config.isNeedTasks && !user.tasks.length) return NaN;
|
||||
|
||||
if (config.formatter) {
|
||||
return config.formatter(user, timestamp);
|
||||
}
|
||||
|
@ -59,6 +67,7 @@ function getValue(config: any, user: any, dataGripByTimestamp: any) {
|
|||
return Array.isArray(value)
|
||||
? value?.length
|
||||
: value;
|
||||
};
|
||||
}
|
||||
|
||||
export default class DataGripByScoring {
|
||||
|
@ -83,7 +92,10 @@ export default class DataGripByScoring {
|
|||
});
|
||||
|
||||
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 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/',
|
||||
// https://gitlab.com/___/___/-/merge_requests/100500
|
||||
},
|
||||
// commitFilters: {
|
||||
// author: '',
|
||||
// message: '',
|
||||
// },
|
||||
employees: [],
|
||||
};
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import splashScreenStore from 'ts/components/SplashScreen/store';
|
|||
import { applicationHasCustom } from 'ts/helpers/RPC';
|
||||
import Depersonalized from 'ts/helpers/Depersonalized';
|
||||
|
||||
import userSettingsStore from './UserSettings';
|
||||
import filtersInHeaderStore from './FiltersInHeader';
|
||||
import viewNameStore, { ViewNameEnum } from './ViewName';
|
||||
|
||||
|
@ -105,13 +106,15 @@ class DataGripStore {
|
|||
dataGrip.clear();
|
||||
fileGrip.clear();
|
||||
|
||||
// const message = userSettingsStore.settings?.commitFilters?.message || '';
|
||||
// const messageCheck = message ? new RegExp(message) : null;
|
||||
|
||||
const depersonalized = new Depersonalized();
|
||||
this.commits.forEach((commit: ICommit | ISystemCommit) => {
|
||||
if (commit.timestamp < filtersInHeaderStore.from
|
||||
|| commit.timestamp > filtersInHeaderStore.to) return;
|
||||
|
||||
// if ((commit.message || '').indexOf('Deploying') !== -1) return;
|
||||
// if ((commit.message || '').indexOf('Deployed') !== -1) return;
|
||||
// if (messageCheck && messageCheck.test(commit.message || '')) return;
|
||||
|
||||
const localCommit = this.isDepersonalized
|
||||
? depersonalized.getCommit(commit)
|
||||
|
|
Loading…
Reference in a new issue