Remove debug logging statements from utility functions and schema files to clean up code and improve performance. This includes the removal of console logs in parseFilter, filterDistributeKeys, normalizeFilterQuery, and the stockevent schema, streamlining the codebase for better maintainability.
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
All checks were successful
farmcontrol/farmcontrol-api/pipeline/head This commit looks good
This commit is contained in:
parent
6a730294b1
commit
5f59c23fbe
@ -1,6 +1,11 @@
|
||||
import mongoose from 'mongoose';
|
||||
import { generateId } from '../../utils.js';
|
||||
import { getObject, editObject, aggregateRollups, aggregateRollupsHistory } from '../../database.js';
|
||||
import {
|
||||
getObject,
|
||||
editObject,
|
||||
aggregateRollups,
|
||||
aggregateRollupsHistory,
|
||||
} from '../../database.js';
|
||||
const { Schema } = mongoose;
|
||||
|
||||
const parentStockModelNames = {
|
||||
@ -43,8 +48,6 @@ const buildParentState = (parentType, parentStock, currentAmount, startingAmount
|
||||
|
||||
const progress = currentAmount / startingAmount;
|
||||
|
||||
console.log('progress', progress);
|
||||
|
||||
if (currentAmount === startingAmount) {
|
||||
return { ...parentStock.state, type: fullState, progress: 1 };
|
||||
}
|
||||
|
||||
@ -137,6 +137,5 @@ export async function makeTradingRequest({
|
||||
response: logResponse ? formatDebugPayload(xml) : undefined,
|
||||
});
|
||||
|
||||
console.log('xml', xml);
|
||||
return xml;
|
||||
}
|
||||
|
||||
@ -739,10 +739,6 @@ async function parseFilter(property, value, model = null) {
|
||||
property = 'state.type';
|
||||
}
|
||||
|
||||
console.log('property', property);
|
||||
console.log('value', value);
|
||||
console.log('model', model);
|
||||
|
||||
const fieldKind = getFilterFieldKind(property, model);
|
||||
const filterProperty = fieldKind.property;
|
||||
const isBoolField = isBooleanField(property, model);
|
||||
@ -1282,7 +1278,6 @@ function filterDistributeKeys(value, keys = DISTRIBUTE_KEYS) {
|
||||
result[key] = val;
|
||||
}
|
||||
}
|
||||
console.log('filterDistributeKeys', result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1676,10 +1671,6 @@ function normalizeFilterQuery(query = {}) {
|
||||
// Returns a filter object based on allowed filters and req.query
|
||||
async function getFilter(query, allowedFilters, parse = true, model = null) {
|
||||
const clauses = [];
|
||||
console.log('query', query);
|
||||
console.log('allowedFilters', allowedFilters);
|
||||
console.log('parse', parse);
|
||||
console.log('model', model);
|
||||
const queryClean = normalizeFilterQuery(query);
|
||||
for (const key of ['sortProperty', 'sortOrder', 'page', 'limit']) {
|
||||
if (key in queryClean) delete queryClean[key];
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user