Commit a768ff29 authored by 任国军's avatar 任国军

babyDefaultName change to '' && report add more filter choose

parent eec0b0aa
Pipeline #23161 passed with stage
in 12 seconds
......@@ -20,6 +20,7 @@ module.exports = app => {
column_option: INTEGER,
column_value: STRING,
column_score: INTEGER,
is_retain: INTEGER,
status: INTEGER,
is_deleted: INTEGER,
created_time: {
......
......@@ -19,6 +19,7 @@ module.exports = app => {
column_option: INTEGER,
column_value: STRING,
column_score: INTEGER,
is_retain: INTEGER,
status: INTEGER,
is_deleted: INTEGER,
created_time: {
......
......@@ -270,9 +270,35 @@ class ReportService extends Service {
const ageFilterList = await ctx.classModel.V5.CourseV5AgeToFilter.findAll({ where: { age_id: babyAge, cat_id: catId, status: 1, is_deleted: 0 }, raw: true });
answerFilterList = _.concat(answerFilterList, ageFilterList);
// 先做筛选
const where = await this.classFilter(answerFilterList, catId, babyAge);
let classList = await ctx.classModel.V5.CourseV5Class.findAll({ where, attributes: [ 'id', 'institution_id', 'name', 'logo', 'age', 'price', 'price_type', 'mode', 'time', 'class_amount', 'multi_classes', 'cycle', 'sort' ], raw: true });
// 获取所有可以删除的条件数
let notRetain = 0;
for (const v of answerFilterList) {
if (v.is_retain === 0) {
notRetain++;
}
}
// 循环删除条件,直到满足3个
let classList = [];
for (let i = 0; i <= notRetain; i++) {
const tmpAnswerFilterList = [];
let tmpCount = 0;
for (const v of answerFilterList) {
if (v.is_retain === 0 && tmpCount < i) {
tmpCount++;
} else {
tmpAnswerFilterList.push(v);
}
}
// 筛选
const where = await this.classFilter(tmpAnswerFilterList, catId, babyAge);
classList = await ctx.classModel.V5.CourseV5Class.findAll({ where, attributes: [ 'id', 'institution_id', 'name', 'logo', 'age', 'price', 'filter_price', 'price_type', 'mode', 'time', 'class_amount', 'multi_classes', 'cycle', 'sort' ], raw: true });
if (classList.length >= 3) {
break;
}
}
// 格式化课程
classList = await this.formatClassList(classList);
......
......@@ -274,7 +274,7 @@ class UserService extends Service {
// 上传用户宝宝信息
async addUserBaby(input) {
const { ctx } = this;
const name = input.baby_name || 'qxk' + String(await this.getRandomNumber(6));
const name = input.baby_name || '';
const age = input.baby_age || 0;
const sex = input.baby_sex || 1;
const birth = input.baby_birth || '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment