- // TODO (later...) get only n=100(?) most recent problems
- db.all("SELECT * FROM Problems WHERE variant='" + vname + "'",
- (err2,problems) => {
- if (!!err2)
- return next(err2);
- res.render('variant', {
- title: vname + ' Variant',
- variant: vname,
- problemArray: problems,
- lang: selectLanguage(req, res),
- languages: supportedLang,
- });
- }
- );
+ // Get only N most recent problems
+ const query2 = "SELECT * FROM Problems " +
+ "WHERE variant='" + vname + "' " +
+ "ORDER BY added DESC " +
+ "LIMIT " + MaxNbProblems;
+ db.all(query2, (err2,problems) => {
+ if (!!err2)
+ return next(err2);
+ res.render('variant', {
+ title: vname + ' Variant',
+ variant: vname,
+ problemArray: problems,
+ lang: selectLanguage(req, res),
+ languages: supportedLang,
+ });
+ });