Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
martinheppner committed Sep 21, 2024
2 parents 89d5599 + 0e62075 commit 8033978
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
Binary file added public/range-image/neckar-tauber-gaeuplatten.webp
Binary file not shown.
2 changes: 1 addition & 1 deletion src/jobs/sync.js
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ const deleteFilesOlder30days = async (dirPath) => {
await deleteFilesOlder30days(filePath);
} else if (stats.isFile()) {
const isOlderThan30Days = Date.now() - stats.mtimeMs > 2592000000; // 30 days in milliseconds
if (isOlderThan30Days && Math.random() < 0.5) { // Delete with 50% probability
if (isOlderThan30Days && Math.random() < 0.15) { // Delete with 15% probability
await fs.unlink(filePath);
// console.log(`Deleted ${filePath}`);
}
Expand Down
8 changes: 5 additions & 3 deletions src/routes/searchPhrases.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,23 @@ const listWrapper = async (req, res) => {

const city = req.query.city;
const language = req.query.language;
const tld = req.query.tld.toUpperCase();

const item = await createQuery("phrase", "search_phrase", city, search, language);
const item = await createQuery("phrase", "search_phrase", city, search, language, tld);

const result = item;

return res.status(200).json({success: true, items: result});
}

//queries through the database table "logsearchphrase" and returns the phrases that start with the search phrase
const createQuery = async (field, alias, city, search, language) => {
const createQuery = async (field, alias, city, search, language, tld) => {
let query = knex('logsearchphrase').select(`${field}`)
.as(alias)
.count('* as CNT')
.whereNot(field, null)
.andWhereNot(field, "");
.andWhereNot(field, "")
.andWhere('country_code', tld);

if(!!city && city.length > 0 && city != 'null'){
query = query.andWhere('city_slug', city);
Expand Down
2 changes: 0 additions & 2 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import moment from "moment";

export const round = (value, decimals) => {
decimals = typeof decimals !== 'undefined' ? decimals : 2;
value = parseFloat(value);
Expand Down

0 comments on commit 8033978

Please sign in to comment.