0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2026-06-22 00:38:38 +00:00

last changes

This commit is contained in:
Víctor Losada Hernández
2026-05-30 00:08:07 +02:00
parent 55c4504ed9
commit ed6bf9f1bb
3 changed files with 20 additions and 13 deletions
+4
View File
@@ -111,6 +111,10 @@ body {
vertical-align : middle; vertical-align : middle;
text-align : center; text-align : center;
border-right : 1px solid; border-right : 1px solid;
max-width:50ch;
overflow:hidden;
text-overflow: ellipsis;
white-space: nowrap;
&:last-child { border-right : none; } &:last-child { border-right : none; }
} }
@@ -67,6 +67,7 @@ const BrewCleanup = ({})=>{
return null; return null;
} }
return <> return <>
<h2>{`Results - ${brewList.length} brews` }</h2> <h2>{`Results - ${brewList.length} brews` }</h2>
<table className='resultsTable'> <table className='resultsTable'>
@@ -74,21 +75,21 @@ const BrewCleanup = ({})=>{
<tr> <tr>
<th>Title</th> <th>Title</th>
<th>Last Update</th> <th>Last Update</th>
<th>Created</th> <th>last viewed</th>
<th>Storage</th> <th>Storage</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{brewList {brewList
.sort((a, b)=>{ // Sort brews from most recently updated .sort((a, b)=>{ // Sort brews from most recently updated
if(a.updatedAt > b.updatedAt) return -1; if(a.lastViewed > b.lastViewed) return -1;
return 1; return 1;
}) })
.map((brew, idx)=>{ .map((brew, idx)=>{
return <tr key={idx}> return <tr key={idx}>
<td><strong>{brew.title || 'No Title'}</strong></td> <td><strong>{brew.title || 'No Title'}</strong></td>
<td style={{ width: '200px' }}>{Moment(brew.updatedAt).fromNow()}</td> <td style={{ width: '200px' }}>{Moment(brew.updatedAt).fromNow()}</td>
<td>{brew.createdAt ? Moment(brew.createdAt).fromNow() : 'No creation date'}</td> <td>{brew.lastViewed ? Moment(brew.lastViewed).fromNow() : 'No creation date'}</td>
<td>{brew.googleId ? 'Google' : 'Homebrewery'}</td> <td>{brew.googleId ? 'Google' : 'Homebrewery'}</td>
</tr>; </tr>;
})} })}
@@ -101,7 +102,7 @@ const BrewCleanup = ({})=>{
if(type === 'junk' && junkBrewCollection.length === 0 || type === 'lost' && lostBrewCollection.length === 0) return <div className='result noBrews'>No Matching Brews found.</div>; if(type === 'junk' && junkBrewCollection.length === 0 || type === 'lost' && lostBrewCollection.length === 0) return <div className='result noBrews'>No Matching Brews found.</div>;
return <div className='result'> return <div className='result'>
{renderBrewList(type)}
<button onClick={()=>cleanup(type)} className='remove'> <button onClick={()=>cleanup(type)} className='remove'>
{pending {pending
? <i className='fas fa-spin fa-spinner' /> ? <i className='fas fa-spin fa-spinner' />
@@ -109,7 +110,7 @@ const BrewCleanup = ({})=>{
} }
</button> </button>
<span>Found {type === 'junk' ? junkBrewCollection.length : lostBrewCollection.length} Brews that could be removed. </span> <span>Found {type === 'junk' ? junkBrewCollection.length : lostBrewCollection.length} Brews that could be removed. </span>
{renderBrewList(type)}
</div>; </div>;
}; };
const renderJunkBrewCleanup = ()=>{ const renderJunkBrewCleanup = ()=>{
+10 -8
View File
@@ -50,14 +50,16 @@ export default function createAdminApi(vite) {
]; ];
const lostBrewsPipeline = [ const lostBrewsPipeline = [
{ $match : { {
updatedAt : { $lt: Moment().subtract(365, 'days').toDate() }, $match: {
lastViewed : { $lt: Moment().subtract(365, 'days').toDate() } authors: [],
}}, updatedAt: { $lt: Moment().subtract(9, 'years').toDate() },
{ $match: { lastViewed: { $lt: Moment().subtract(9, 'years').toDate() }
authors : [], }
}}, },
{ $limit: 300 } {
$limit: 1000
}
]; ];
/* Search for brews that aren't compressed (missing the compressed text field) */ /* Search for brews that aren't compressed (missing the compressed text field) */