mirror of
				https://github.com/optim-enterprises-bv/OptimCloud-gw-ui.git
				synced 2025-10-31 18:27:45 +00:00 
			
		
		
		
	[WIFI-11868] Fixed FMS dashboard average age
Signed-off-by: Charles <charles.bourque96@gmail.com>
This commit is contained in:
		
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,12 +1,12 @@ | ||||
| { | ||||
|   "name": "ucentral-client", | ||||
|   "version": "2.8.0(32)", | ||||
|   "version": "2.8.0(33)", | ||||
|   "lockfileVersion": 2, | ||||
|   "requires": true, | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "name": "ucentral-client", | ||||
|       "version": "2.8.0(32)", | ||||
|       "version": "2.8.0(33)", | ||||
|       "license": "ISC", | ||||
|       "dependencies": { | ||||
|         "@chakra-ui/icons": "^2.0.11", | ||||
|   | ||||
| @@ -1,6 +1,6 @@ | ||||
| { | ||||
|   "name": "ucentral-client", | ||||
|   "version": "2.8.0(32)", | ||||
|   "version": "2.8.0(33)", | ||||
|   "description": "", | ||||
|   "private": true, | ||||
|   "main": "index.tsx", | ||||
|   | ||||
| @@ -13,10 +13,11 @@ const AverageFirmwareAge = ({ data }: Props) => { | ||||
|   const parsedData = React.useMemo(() => { | ||||
|     const usingUnknown = data.unknownFirmwares.reduce((acc, curr) => acc + curr.value, 0); | ||||
|     const total = data.numberOfDevices > 0 ? data.numberOfDevices : 1; | ||||
|     const useable = total - usingUnknown; | ||||
|     if (useable <= 0 || !data.usingLatest[0]) return '-'; | ||||
|     const usingLatest = data.usingLatest.reduce((acc, curr) => acc + curr.value, 0); | ||||
|     const useable = total - usingUnknown - usingLatest; | ||||
|     if (useable <= 0 || !data.totalSecondsOld[0]) return '-'; | ||||
|  | ||||
|     const secondsPerDevice = data.usingLatest[0].value / useable; | ||||
|     const secondsPerDevice = data.totalSecondsOld[0].value / useable; | ||||
|     const days = Math.ceil(secondsPerDevice / (60 * 60 * 24)); | ||||
|  | ||||
|     return `${days} ${t('common.days')}`; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Charles
					Charles