sort feedback

This commit is contained in:
adueck 2023-08-28 15:00:11 +04:00
parent 72c6f4bf79
commit 7ba898d988
2 changed files with 9 additions and 5 deletions

View File

@ -66,11 +66,15 @@ export async function getAllLingdocsUsers(): Promise<T.LingdocsUser[]> {
} }
export async function getAllFeedback(): Promise<any[]> { export async function getAllFeedback(): Promise<any[]> {
const res = await feedbackDb.find({ const { docs } = await feedbackDb.find({
selector: { feedback: { $exists: true } }, selector: {
feedback: { $exists: true },
limit: 5000,
},
}); });
console.log({ res }); // @ts-ignore
return res.docs as any[]; docs.sort((a, b) => a.feedback.ts - b.feedback.ts);
return docs as any[];
} }
export async function insertLingdocsUser( export async function insertLingdocsUser(

View File

@ -29,7 +29,7 @@
<%= new Date(docs[i].feedback.ts).toDateString() %> <%= new Date(docs[i].feedback.ts).toDateString() %>
</td> </td>
<td> <td>
<%= docs[i].feedback.user %> <%= docs[i].user %>
</td> </td>
<td> <td>
<%= docs[i].feedback.chapter %> <%= docs[i].feedback.chapter %>