generated from tpl/obsidian-sample-plugin
			Fix last entry updating and remove logging
This commit is contained in:
		
							parent
							
								
									a7276211d4
								
							
						
					
					
						commit
						c58f1c4bf5
					
				| 
						 | 
					@ -45,7 +45,6 @@
 | 
				
			||||||
		await onChange?.(query);
 | 
							await onChange?.(query);
 | 
				
			||||||
	});
 | 
						});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	$inspect(value, query, items);
 | 
					 | 
				
			||||||
	$effect.root(() => {
 | 
						$effect.root(() => {
 | 
				
			||||||
		function findIndex(value: T | undefined) {
 | 
							function findIndex(value: T | undefined) {
 | 
				
			||||||
			return items.findIndex((item) => item.value === value);
 | 
								return items.findIndex((item) => item.value === value);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -87,7 +87,7 @@ export class ReadingLog {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (lastEntry && isSameDay(lastEntry.createdAt, newEntry.createdAt)) {
 | 
							if (lastEntry && isSameDay(lastEntry.createdAt, newEntry.createdAt)) {
 | 
				
			||||||
			newEntry.pagesRead += lastEntry.pagesRead;
 | 
								newEntry.pagesRead += lastEntry.pagesRead;
 | 
				
			||||||
			await this.updateEntry(this.entries.indexOf(lastEntry), lastEntry);
 | 
								await this.updateEntry(this.entries.indexOf(lastEntry), newEntry);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			await this.addRawEntry(newEntry);
 | 
								await this.addRawEntry(newEntry);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue