File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,9 +42,10 @@ const addLog = async (page)=>{
4242 const results = { } ;
4343 for ( const category of cateogires ) {
4444 const element = category == "best-practices" ?"bestPractices" :category ;
45- const score = res . lighthouseResult . categories [ category ] . score * 100 ;
45+ const score = Math . floor ( res . lighthouseResult . categories [ category ] . score * 100 ) ;
4646 if ( averages [ strategy ] [ element ] ) {
47- if ( ( averages [ strategy ] [ element ] - score ) > config . allowed_drop ) {
47+ const diff = Math . floor ( averages [ strategy ] [ element ] - score ) ;
48+ if ( diff > config . allowed_drop ) {
4849 if ( config . alert ) {
4950 sendAlert ( {
5051 category : element ,
@@ -53,6 +54,7 @@ const addLog = async (page)=>{
5354 score : score ,
5455 page : page . name ,
5556 url : page . url ,
57+ diff : diff ,
5658 } ) ;
5759 }
5860 }
@@ -86,7 +88,7 @@ async function sendAlert(alert) {
8688 const mailOptions = {
8789 from : config . email_user ,
8890 to : config . email_to ,
89- subject : `[charizard][alert] drop in ${ alert . category } score in ${ alert . page } page` ,
91+ subject : `[charizard][alert] drop in ${ alert . category } score ${ alert . diff } in ${ alert . page } page` ,
9092 html : template ,
9193 } ;
9294 transporter . sendMail ( mailOptions , function ( error , info ) {
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ tr:nth-child(even){background-color: #f2f2f2}
2323</head >
2424<body >
2525
26- <h2 ><span class =" red" >ALERT:</span > Drop in <%= category%> score '<%= score %> %' in <%= page%> page</h2 >
26+ <h2 ><span class =" red" >ALERT:</span > Drop in <%= category%> score '<%= diff %> %' in <%= page%> page</h2 >
2727
2828<div style =" overflow-x :auto ;" >
2929 <table >
You can’t perform that action at this time.
0 commit comments