Commit f06d7585 by lixinming

修复 做任务得负分的bug

parent f4443e74
......@@ -70,9 +70,9 @@ export async function updateScore(uscc:string, type:number, isSubmitTask:boolean
/**得分信息 */
let scoreInfo = await scoreData.findFuHuaQiScoreInfo(uscc);
let fuHuaQiInfo = await findFuHuaQiByUSCC(uscc);
let newScore = 0;//新分数
let oldScore = 0;//老分数
let countScore = scoreInfo.startScore +scoreInfo.myDataScore +scoreInfo.baseDataScore +scoreInfo.myEnterpriseScore +scoreInfo.taskScore;
let newScore = 0;//新_模块分数
let oldScore = 0;//老_模块分数
let countScore = scoreInfo.startScore +scoreInfo.myDataScore +scoreInfo.baseDataScore +scoreInfo.myEnterpriseScore +scoreInfo.taskScore;//总分
switch (type) {
case SCOREWAYS.任务得分:
/**单个任务得分 */
......@@ -124,7 +124,7 @@ export async function updateScore(uscc:string, type:number, isSubmitTask:boolean
let newCountScore = countScore - oldScore + newScore;
if (SCOREWAYS.任务得分 == type) {
newScore = -1 * newScore;
// newScore = -1 * newScore;
await scoreLogData.addLog(uscc, type, changeMode, newCountScore, newScore, subType);
} else {
await scoreLogData.addLog(uscc, type, changeMode, newCountScore, newScore);
......@@ -199,13 +199,13 @@ export async function fuHuaQiScoreLog(uscc:string, year:number) {
let logList = await scoreLogData.getLog(uscc, startTime, endTime);
logList.sort( (a, b) => {return a.timeMs - b.timeMs });
let distinctMap = {};
let distinctMap = {};//{timeKey:[] }
logList.forEach(info => {
let timeKey = moment(info.timeMs).format("YYYY-MM");
if ( !distinctMap[timeKey] ) distinctMap[timeKey] = [];
let itemWaysStr = waysStr(info.ways, info.taskType, info.changeMode);
itemWaysStr += `${Math.ceil(info.addScore)}分`;
itemWaysStr += `${Math.abs(info.addScore)}分`;
distinctMap[timeKey].push({
score:Math.ceil(info.score),
......@@ -217,6 +217,7 @@ export async function fuHuaQiScoreLog(uscc:string, year:number) {
let dataList = [];
for (let key in distinctMap) {
let count = distinctMap[key].length;
distinctMap[key].sort((a,b) => {return b.timeMs - a.timeMs });
dataList.push({
key,
count,
......@@ -253,8 +254,6 @@ function waysStr(ways:number, type:number, changeMode) {
return str;
}
/**
* 排行榜
* @param uscc 孵化器统一信用代码
......@@ -280,4 +279,4 @@ export async function rankList(uscc:string) {
});
return {rankList, thisFuHuaQiIndex};
}
\ No newline at end of file
}
......@@ -13,7 +13,7 @@ const fuHuaQiScoreLogSchema = new Schema({
ways:Number,//途径 遵循枚举 SCOREWAYS 值
taskType:Number,//任务类型 遵循枚举 TASKTYPEENUM 值
changeMode:Number,//分数变化方式 遵循枚举 CHANGEMODE 值
score:Number,//分数
score:Number,//变化后的分数
addScore:Number,//增加/减少的分数
timeMs:{type:Number, index:true}//获得时间 时间戳
});
......
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