mirror of
https://github.com/bakhirev/assayo.git
synced 2024-11-16 16:21:41 +00:00
update
This commit is contained in:
parent
95ec78042b
commit
2051b5dbd1
|
@ -17,7 +17,9 @@
|
||||||
<link rel="canonical" href="https://assayo.online/demo/">
|
<link rel="canonical" href="https://assayo.online/demo/">
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var report = [];
|
var r = [];
|
||||||
|
var report = r;
|
||||||
|
var f = String.raw.bind(String);
|
||||||
</script>
|
</script>
|
||||||
<link rel="icon" href="%PUBLIC_URL%/favicon.svg" />
|
<link rel="icon" href="%PUBLIC_URL%/favicon.svg" />
|
||||||
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
|
||||||
|
|
156562
public/test.txt
156562
public/test.txt
File diff suppressed because it is too large
Load diff
|
@ -8,22 +8,28 @@
|
||||||
// onChange('meta', { byTaskId });
|
// onChange('meta', { byTaskId });
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
function getGlobalValue() { // @ts-ignore
|
||||||
|
return window.r || window.report;
|
||||||
|
}
|
||||||
|
|
||||||
|
function setGlobalValue(value?: any) { // @ts-ignore
|
||||||
|
window.r = value || []; // @ts-ignore
|
||||||
|
window.report = window.r;
|
||||||
|
}
|
||||||
|
|
||||||
export function getStringsForParser(text: string) {
|
export function getStringsForParser(text: string) {
|
||||||
// @ts-ignore
|
let temp = getGlobalValue();
|
||||||
let temp = window.report; // @ts-ignore
|
setGlobalValue([]);
|
||||||
window.report = [];
|
|
||||||
const firstText = text.slice(0, 12);
|
const firstText = text.slice(0, 12);
|
||||||
if (firstText === 'report.push(') {
|
if (firstText === 'report.push(') {
|
||||||
try {
|
try {
|
||||||
eval(text);
|
eval(text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
// error(`Файл отчёта содержит запрещенный символ.\nОткройте его в редакторе и проверьте.\n${e.stack}`)
|
setGlobalValue(temp);
|
||||||
// @ts-ignore
|
|
||||||
window.report = temp;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else { // @ts-ignore
|
} else {
|
||||||
window.report = text.split('\n');
|
setGlobalValue(text.split('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
|
@ -3,6 +3,7 @@ import IHashMap from 'ts/interfaces/HashMap';
|
||||||
|
|
||||||
import { ONE_DAY } from 'ts/helpers/formatter';
|
import { ONE_DAY } from 'ts/helpers/formatter';
|
||||||
import { increment } from 'ts/helpers/Math';
|
import { increment } from 'ts/helpers/Math';
|
||||||
|
import getCompany from '../helpers/getCompany';
|
||||||
|
|
||||||
import userSettings from 'ts/store/UserSettings';
|
import userSettings from 'ts/store/UserSettings';
|
||||||
|
|
||||||
|
@ -119,8 +120,6 @@ export default class DataGripByAuthor {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static getDefaultCommitsByDayAndHour() {
|
static getDefaultCommitsByDayAndHour() {
|
||||||
return (new Array(7)).fill(1).map(() => (new Array(24)).fill(0));
|
return (new Array(7)).fill(1).map(() => (new Array(24)).fill(0));
|
||||||
}
|
}
|
||||||
|
@ -187,6 +186,7 @@ export default class DataGripByAuthor {
|
||||||
daysForTask: isStaff ? 0 : workDays / tasks.length,
|
daysForTask: isStaff ? 0 : workDays / tasks.length,
|
||||||
taskInDay: isStaff ? 0 : tasks.length / workDays,
|
taskInDay: isStaff ? 0 : tasks.length / workDays,
|
||||||
changesForTask: DataGripByAuthor.getMiddleValue(tasksSize),
|
changesForTask: DataGripByAuthor.getMiddleValue(tasksSize),
|
||||||
|
company: getCompany(dot.author, dot.lastCommit.email),
|
||||||
|
|
||||||
days: workDays,
|
days: workDays,
|
||||||
money: isStaff ? 0 : moneyWorked,
|
money: isStaff ? 0 : moneyWorked,
|
||||||
|
|
51
src/ts/helpers/DataGrip/helpers/getCompany.ts
Normal file
51
src/ts/helpers/DataGrip/helpers/getCompany.ts
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
const PUBLIC_SERVICES = [
|
||||||
|
'icloud',
|
||||||
|
'google',
|
||||||
|
'yahoo',
|
||||||
|
'aol',
|
||||||
|
'zoho',
|
||||||
|
'outlook',
|
||||||
|
'gmx',
|
||||||
|
'tutanota',
|
||||||
|
'vk',
|
||||||
|
'ok',
|
||||||
|
'ya',
|
||||||
|
'yandex',
|
||||||
|
'rambler',
|
||||||
|
'github',
|
||||||
|
'gitlab',
|
||||||
|
];
|
||||||
|
|
||||||
|
const isPublicService = Object.fromEntries(
|
||||||
|
Object.values(PUBLIC_SERVICES).map(key => [key.toUpperCase(), true]),
|
||||||
|
);
|
||||||
|
|
||||||
|
function getCompanyByName(author?: string): string {
|
||||||
|
const tags = (author || '')
|
||||||
|
.toUpperCase()
|
||||||
|
.match(/(\[[^\]]+])/gim) || [];
|
||||||
|
|
||||||
|
const companies = tags
|
||||||
|
.map(v => v.replace(/([\[\]]+)/gim, '').trim().split(','))
|
||||||
|
.flat(Infinity);
|
||||||
|
|
||||||
|
return companies.length
|
||||||
|
? companies[0] as string
|
||||||
|
: '';
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCompanyByEmail(email?: string) {
|
||||||
|
const domain = (email || '').split('@').pop() || '';
|
||||||
|
const company = domain.split('.').shift() || '';
|
||||||
|
return company.toUpperCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
function getCompany(author?: string, email?: string) {
|
||||||
|
const company = getCompanyByName(author) || getCompanyByEmail(email) || '';
|
||||||
|
const isMailService = company.indexOf('MAIL') !== -1;
|
||||||
|
return isPublicService[company] || isMailService
|
||||||
|
? ''
|
||||||
|
: company;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default getCompany;
|
|
@ -37,9 +37,9 @@ function loadJsLGlobal(url: string, callback: Function) {
|
||||||
if (text[0] === 'r') {
|
if (text[0] === 'r') {
|
||||||
eval(text);
|
eval(text);
|
||||||
return callback();
|
return callback();
|
||||||
} else {
|
} else { // @ts-ignore
|
||||||
// @ts-ignore
|
window.r = text.split('\n'); // @ts-ignore
|
||||||
window.report = text.split('\n');
|
window.report = window.r;
|
||||||
}
|
}
|
||||||
callback();
|
callback();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue