Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicola Lanzilotto committed Dec 31, 2024
1 parent 760c1ef commit a81ddc7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,11 @@
<div class="flex flex-col flex-auto overflow-hidden items-center">

<span class="graph-footer-num">
{{percentageOfRequestsHandledByBots}}%
{{percentageOfRequestsHandledByBots}}<span class="home-percentage-symbol">%</span>
</span>
<!-- <span *ngIf="numOfDays === 7" class="graph-footer-num"> {{percentageOfSevenDaysRequestsHandledByBots}}% </span>
<span *ngIf="numOfDays === 30" class="graph-footer-num"> {{percentageOfLastMonthRequestsHandledByBots}}% </span> -->
<span class="graph-footer-text"> percentage handled by bots</span>
<span class="graph-footer-text"> Percentage handled by bots</span>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}

.gap-3 {
gap: 3px!important;
gap: 3px !important;
}

.flex-auto {
Expand Down Expand Up @@ -160,6 +160,10 @@
font-weight: 400;
}

.home-percentage-symbol {
font-size: 21px;
}

// @media (min-width: 600px) {
// .sm\:grid-cols-2 {
// grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,11 @@ export class HomeConvsGraphComponent implements OnInit, OnChanges {
}


getMaxValueFromArrays(array1: number[], array2: number[]): number {
const mergedArray = [...array1, ...array2];
console.log('mergedArray', mergedArray)
return Math.max(...mergedArray);
}

getRequestByLastNDayMerge(lastdays) {
this.logger.log('[HOME-CONVS-GRAPH] - -> NEW METHOD lastdays ', lastdays);
Expand Down Expand Up @@ -376,10 +381,9 @@ export class HomeConvsGraphComponent implements OnInit, OnChanges {
this.totalHuman = humanCounts.reduce((sum, val) => sum + val, 0);
this.totalBot = botCounts.reduce((sum, val) => sum + val, 0);

// const higherCount = this.getMaxOfArray(this.totalHuman + this.totalBot);
const higherCount = this.getMaxValueFromArrays(humanCounts, botCounts);

this.percentageOfRequestsHandledByBots =
this.totalBot > 0 ? ((this.totalBot / (this.totalHuman + this.totalBot)) * 100).toFixed(1).replace('.', ',') : '0';
this.percentageOfRequestsHandledByBots = this.totalBot > 0 ? ((this.totalBot / (this.totalHuman + this.totalBot)) * 100).toFixed(1).replace('.', ',') : '0';


this.logger.log('[HOME-CONVS-GRAPH] - -> NEW METHOD Human Total:', this.totalHuman);
Expand All @@ -388,13 +392,13 @@ export class HomeConvsGraphComponent implements OnInit, OnChanges {
this.logger.log('[HOME-CONVS-GRAPH] - -> NEW METHOD labels:', labels);

// Step 6: Render the chart
this.renderChart(labels, humanCounts, botCounts);
this.renderChart(labels, humanCounts, botCounts,higherCount);
}, (error) => {
this.logger.error('[HOME-CONVS-GRAPH] - -> NEW METHOD ERROR:', error);
});
}

renderChart(labels, humanCounts, botCounts) {
renderChart(labels, humanCounts, botCounts, higherCount) {

this.lineChart = new Chart('lastNdayChart', {
type: 'line',
Expand Down Expand Up @@ -478,7 +482,7 @@ export class HomeConvsGraphComponent implements OnInit, OnChanges {
},
display: true,
fontColor: 'white',
// suggestedMax: this.higherCount + 1,
suggestedMax: higherCount + 1,
}
}]
},
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/role.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class RoleService {
this.logger.log('[ROLE-SERV] - checkRoleForCurrentProject projectUserRole', projectUserRole)
}
} else {
this.logger.error('[ROLE-SERV] - checkRoleForCurrentProject projectUserRole * Error *', projectUserRole)
this.logger.log('[ROLE-SERV] - checkRoleForCurrentProject projectUserRole * Error *', projectUserRole)
const _projectUserRole = await this.getProjectUser(userId, projectId)
this.logger.log('[ROLE-SERV] - checkRoleForCurrentProject _projectUserRole GET from remote', _projectUserRole)
if (_projectUserRole === 'agent') {
Expand Down

0 comments on commit a81ddc7

Please sign in to comment.