feat: add log result formatter
This commit is contained in:
		
							parent
							
								
									4a943d9483
								
							
						
					
					
						commit
						8ff4092ebc
					
				
					 1 changed files with 40 additions and 0 deletions
				
			
		
							
								
								
									
										40
									
								
								scripts/database/entry/log.JS
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								scripts/database/entry/log.JS
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,40 @@ | |||
| const Entry = require(`./object.JS`); | ||||
| 
 | ||||
| class Log extends Entry { | ||||
| 	// Default properties
 | ||||
| 	name; | ||||
| 	ID; | ||||
| 	count;  | ||||
| 	activities;  | ||||
| 
 | ||||
| 	constructor(PROPERTIES) { | ||||
| 		super(PROPERTIES); | ||||
| 		this.calculate(); | ||||
| 	} | ||||
| 
 | ||||
| 	/*  | ||||
| 		Update and clean information.  | ||||
| 	*/ | ||||
| 	calculate () { | ||||
| 		const set_activitiesCount = () => { | ||||
| 			this.count = (this.activities instanceof Array) ? this.activities.length : 0; | ||||
| 		}; | ||||
| 		 | ||||
| 		const clean_activities = () => { | ||||
| 			if ((this.activities instanceof Array) ? this.activities.length : false) { | ||||
| 				for (let INDEX = 0; INDEX < this.activities.length ; INDEX++) { | ||||
| 					[`username`].forEach((TBD) => { | ||||
| 						if (Object.keys(this.activities[INDEX].includes(TBD))) { | ||||
| 							delete this.activities[INDEX][TBD] | ||||
| 						} | ||||
| 					}) | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 		clean_activities(); | ||||
| 		set_activitiesCount(); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| module.exports = Log; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue