bugfixing: show last X years correctly for quarter results
This commit is contained in:
parent
1de76c212b
commit
465e7385de
@ -379,11 +379,23 @@ const exportData = (format = 'csv') => {
|
||||
|
||||
fullStatement = data?.getBalanceSheetStatement;
|
||||
timeFrame = '10Y';
|
||||
balanceSheet = fullStatement?.slice(0,10);
|
||||
displayStatement = 'cashAndCashEquivalents';
|
||||
|
||||
|
||||
|
||||
const getCurrentYear = () => new Date()?.getFullYear();
|
||||
|
||||
const filterStatement = (fullStatement, timeFrame) => {
|
||||
const currentYear = getCurrentYear();
|
||||
|
||||
switch(timeFrame) {
|
||||
case '5Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 5);
|
||||
case '10Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 10);
|
||||
default:
|
||||
return fullStatement;
|
||||
}
|
||||
};
|
||||
|
||||
$: {
|
||||
if (timeFrame || displayStatement || filterRule)
|
||||
{
|
||||
@ -395,11 +407,7 @@ $: {
|
||||
fullStatement = data?.getBalanceSheetStatement;
|
||||
}
|
||||
|
||||
balanceSheet = timeFrame === '5Y'
|
||||
? (fullStatement?.slice(0, 5))
|
||||
: timeFrame === '10Y'
|
||||
? (fullStatement?.slice(0, 10))
|
||||
: fullStatement;
|
||||
balanceSheet = filterStatement(fullStatement, timeFrame);
|
||||
|
||||
if (mode === true)
|
||||
{
|
||||
|
||||
@ -344,11 +344,24 @@ const exportData = (format = 'csv') => {
|
||||
fullStatement = data?.getCashFlowStatement;
|
||||
|
||||
timeFrame = '10Y';
|
||||
cashFlow = fullStatement?.slice(0,10);
|
||||
displayStatement = 'netIncome';
|
||||
|
||||
|
||||
|
||||
const getCurrentYear = () => new Date()?.getFullYear();
|
||||
|
||||
const filterStatement = (fullStatement, timeFrame) => {
|
||||
const currentYear = getCurrentYear();
|
||||
|
||||
switch(timeFrame) {
|
||||
case '5Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 5);
|
||||
case '10Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 10);
|
||||
default:
|
||||
return fullStatement;
|
||||
}
|
||||
};
|
||||
|
||||
$: {
|
||||
if (timeFrame || displayStatement || filterRule)
|
||||
{
|
||||
@ -359,11 +372,7 @@ $: {
|
||||
fullStatement = data?.getCashFlowStatement;
|
||||
}
|
||||
|
||||
cashFlow = timeFrame === '5Y'
|
||||
? (fullStatement?.slice(0, 5))
|
||||
: timeFrame === '10Y'
|
||||
? (fullStatement?.slice(0, 10))
|
||||
: fullStatement;
|
||||
cashFlow = filterStatement(fullStatement, timeFrame);
|
||||
|
||||
if (mode === true)
|
||||
{
|
||||
|
||||
@ -315,10 +315,23 @@ const exportData = (format = 'csv') => {
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
const getCurrentYear = () => new Date()?.getFullYear();
|
||||
|
||||
const filterStatement = (fullStatement, timeFrame) => {
|
||||
const currentYear = getCurrentYear();
|
||||
|
||||
switch(timeFrame) {
|
||||
case '5Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 5);
|
||||
case '10Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 10);
|
||||
default:
|
||||
return fullStatement;
|
||||
}
|
||||
};
|
||||
|
||||
fullStatement = data?.getIncomeStatement;
|
||||
timeFrame = '10Y';
|
||||
income = fullStatement?.slice(0,10);
|
||||
displayStatement = 'revenue';
|
||||
|
||||
|
||||
@ -331,12 +344,7 @@ const exportData = (format = 'csv') => {
|
||||
else {
|
||||
fullStatement = data?.getIncomeStatement;
|
||||
}
|
||||
|
||||
income = timeFrame === '5Y'
|
||||
? (fullStatement?.slice(0, 5))
|
||||
: timeFrame === '10Y'
|
||||
? (fullStatement?.slice(0, 10))
|
||||
: fullStatement;
|
||||
income = filterStatement(fullStatement, timeFrame);
|
||||
|
||||
if (mode === true)
|
||||
{
|
||||
|
||||
@ -288,10 +288,22 @@ const exportData = (format = 'csv') => {
|
||||
|
||||
fullStatement = data?.getRatiosStatement;
|
||||
timeFrame = '10Y';
|
||||
ratios = fullStatement?.slice(0,10);
|
||||
displayStatement = 'priceEarningsRatio';
|
||||
|
||||
const getCurrentYear = () => new Date()?.getFullYear();
|
||||
|
||||
const filterStatement = (fullStatement, timeFrame) => {
|
||||
const currentYear = getCurrentYear();
|
||||
|
||||
switch(timeFrame) {
|
||||
case '5Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 5);
|
||||
case '10Y':
|
||||
return fullStatement?.filter(item => currentYear - parseInt(item?.calendarYear) < 10);
|
||||
default:
|
||||
return fullStatement;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
$: {
|
||||
@ -304,11 +316,7 @@ $: {
|
||||
fullStatement = data?.getRatiosStatement;
|
||||
}
|
||||
|
||||
ratios = timeFrame === '5Y'
|
||||
? (fullStatement?.slice(0, 5))
|
||||
: timeFrame === '10Y'
|
||||
? (fullStatement?.slice(0, 10))
|
||||
: fullStatement;
|
||||
ratios = filterStatement(fullStatement, timeFrame);
|
||||
|
||||
if (mode === true)
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user