Revert "Eliminate if-statement (#3556)"
This reverts commit fb8b0c291d.
			
			
This commit is contained in:
		
							parent
							
								
									197e2c8377
								
							
						
					
					
						commit
						b1b5a795c8
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -61,7 +61,11 @@ export default abstract class Chart<T> {
 | 
			
		|||
 | 
			
		||||
	constructor(name: string, grouped = false) {
 | 
			
		||||
		this.collection = db.get<Log<T>>(`chart.${name}`);
 | 
			
		||||
		this.collection.createIndex({ span: -1, date: -1, group: grouped ? -1 : undefined }, { unique: true });
 | 
			
		||||
		if (grouped) {
 | 
			
		||||
			this.collection.createIndex({ span: -1, date: -1, group: -1 }, { unique: true });
 | 
			
		||||
		} else {
 | 
			
		||||
			this.collection.createIndex({ span: -1, date: -1 }, { unique: true });
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	@autobind
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue