This commit is contained in:
bakhirev 2024-09-06 14:40:53 +03:00
parent 95ec78042b
commit 2051b5dbd1
6 changed files with 78354 additions and 78295 deletions

View file

@ -17,7 +17,9 @@
<link rel="canonical" href="https://assayo.online/demo/">
<script type="text/javascript">
var report = [];
var r = [];
var report = r;
var f = String.raw.bind(String);
</script>
<link rel="icon" href="%PUBLIC_URL%/favicon.svg" />
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />

File diff suppressed because it is too large Load diff

View file

@ -8,22 +8,28 @@
// 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) {
// @ts-ignore
let temp = window.report; // @ts-ignore
window.report = [];
let temp = getGlobalValue();
setGlobalValue([]);
const firstText = text.slice(0, 12);
if (firstText === 'report.push(') {
try {
eval(text);
} catch (e) {
// error(`Файл отчёта содержит запрещенный символ.\nОткройте его в редакторе и проверьте.\n${e.stack}`)
// @ts-ignore
window.report = temp;
setGlobalValue(temp);
return;
}
} else { // @ts-ignore
window.report = text.split('\n');
} else {
setGlobalValue(text.split('\n'));
}
// @ts-ignore

View file

@ -3,6 +3,7 @@ import IHashMap from 'ts/interfaces/HashMap';
import { ONE_DAY } from 'ts/helpers/formatter';
import { increment } from 'ts/helpers/Math';
import getCompany from '../helpers/getCompany';
import userSettings from 'ts/store/UserSettings';
@ -119,8 +120,6 @@ export default class DataGripByAuthor {
};
}
static getDefaultCommitsByDayAndHour() {
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,
taskInDay: isStaff ? 0 : tasks.length / workDays,
changesForTask: DataGripByAuthor.getMiddleValue(tasksSize),
company: getCompany(dot.author, dot.lastCommit.email),
days: workDays,
money: isStaff ? 0 : moneyWorked,

View 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;

View file

@ -37,9 +37,9 @@ function loadJsLGlobal(url: string, callback: Function) {
if (text[0] === 'r') {
eval(text);
return callback();
} else {
// @ts-ignore
window.report = text.split('\n');
} else { // @ts-ignore
window.r = text.split('\n'); // @ts-ignore
window.report = window.r;
}
callback();
});