@@ -148,14 +148,12 @@ async function loadNationCredData() {
148
148
nationCredScore2WeeksAgo = nationCredScore1WeekAgo
149
149
nationCredScore1WeekAgo = nationCredScore
150
150
const activeThreshold = 1.00
151
- const isActive = ( nationCredScore4WeeksAgo && ( nationCredScore4WeeksAgo > activeThreshold ) )
152
- && ( nationCredScore3WeeksAgo && ( nationCredScore3WeeksAgo > activeThreshold ) )
153
- && ( nationCredScore2WeeksAgo && ( nationCredScore2WeeksAgo > activeThreshold ) )
154
- && ( nationCredScore1WeekAgo && ( nationCredScore1WeekAgo > activeThreshold ) )
155
- console . info ( 'isActive:' , isActive )
156
151
157
- const isInactive = nationCredScore1WeekAgo && ( nationCredScore1WeekAgo <= activeThreshold )
158
- && nationCredScore2WeeksAgo && ( nationCredScore2WeeksAgo <= activeThreshold ) ;
152
+ let first2Week = ( nationCredScore4WeeksAgo ?? 0 ) + ( nationCredScore3WeeksAgo ?? 0 )
153
+ let last2Week = ( nationCredScore1WeekAgo ?? 0 ) + ( nationCredScore2WeeksAgo ?? 0 )
154
+
155
+ const isActive = first2Week >= activeThreshold && last2Week >= activeThreshold
156
+ console . info ( 'isActive:' , isActive )
159
157
160
158
// Export to CSV
161
159
const csvRow = {
@@ -165,7 +163,7 @@ async function loadNationCredData() {
165
163
operations_hours : Number ( operationsHours . toFixed ( 2 ) ) ,
166
164
nationcred_score : Number ( nationCredScore . toFixed ( 2 ) ) ,
167
165
nationcred_score_accumulated : Number ( nationCredScoreAccumulated . toFixed ( 2 ) ) ,
168
- is_active : Boolean ( isActive && ! isInactive )
166
+ is_active : Boolean ( isActive )
169
167
}
170
168
csvRows . push ( csvRow )
171
169
0 commit comments