Commit e1d6e3c2 by Performance System

1

parent a6d29b61
Pipeline #3232 passed with stage
in 1 minute 0 seconds
...@@ -125,9 +125,20 @@ class MonthlyScheduler: ...@@ -125,9 +125,20 @@ class MonthlyScheduler:
institution_count = len(user_institutions) institution_count = len(user_institutions)
total_images = sum(len(inst['images']) for inst in user_institutions) total_images = sum(len(inst['images']) for inst in user_institutions)
# 简化的分数计算(实际应用中可能需要更复杂的逻辑) # 计算互动得分:二元计分算法(与前端保持一致)
interaction_score = min(total_images * 0.5, 10.0) # 每张图片0.5分,最高10分 interaction_score = 0
performance_score = min(total_images * 2.5, 50.0) # 每张图片2.5分,最高50分 for inst in user_institutions:
image_count = len(inst['images'])
if image_count == 0:
interaction_score += 0 # 0张图片 = 0分
else:
interaction_score += 1 # 1张及以上图片 = 1分
# 计算绩效得分:绩效得分 = 互动得分 ÷ 名下的带教机构数 × 10
if institution_count > 0:
performance_score = (interaction_score / institution_count) * 10
else:
performance_score = 0
user_stat = { user_stat = {
'userId': user['id'], 'userId': user['id'],
......
...@@ -613,7 +613,7 @@ export const useDataStore = defineStore('data', () => { ...@@ -613,7 +613,7 @@ export const useDataStore = defineStore('data', () => {
/** /**
* 计算用户的交互得分 * 计算用户的交互得分
* 新算法:0张图片=0分,1张图片=0.5分,2张及以上=1分 * 新算法:0张图片=0分,1张及以上图片=1分(二元计分)
*/ */
const calculateInteractionScore = (userId) => { const calculateInteractionScore = (userId) => {
const userInstitutions = getInstitutionsByUserId(userId) const userInstitutions = getInstitutionsByUserId(userId)
...@@ -625,14 +625,12 @@ export const useDataStore = defineStore('data', () => { ...@@ -625,14 +625,12 @@ export const useDataStore = defineStore('data', () => {
for (const institution of userInstitutions) { for (const institution of userInstitutions) {
const imageCount = institution.images ? institution.images.length : 0 const imageCount = institution.images ? institution.images.length : 0
// 新的互动得分算法 // 新的互动得分算法:二元计分
let institutionScore = 0 let institutionScore = 0
if (imageCount === 0) { if (imageCount === 0) {
institutionScore = 0 institutionScore = 0 // 0张图片 = 0分
} else if (imageCount === 1) {
institutionScore = 0.5
} else { } else {
institutionScore = 1 institutionScore = 1 // 1张及以上图片 = 1分
} }
totalScore += institutionScore totalScore += institutionScore
......
...@@ -1182,8 +1182,8 @@ const userUploadStats = computed(() => { ...@@ -1182,8 +1182,8 @@ const userUploadStats = computed(() => {
const users = regularUsers.value const users = regularUsers.value
const stats = users.map(user => { const stats = users.map(user => {
const userInstitutions = dataStore.getInstitutionsByUserId(user.id) const userInstitutions = dataStore.getInstitutionsByUserId(user.id)
// 与普通用户面板保持一致:至少2张图片才算完成 // 与普通用户面板保持一致:至少1张图片才算完成(二元计分算法)
const uploadedCount = userInstitutions.filter(inst => inst.images.length >= 2).length const uploadedCount = userInstitutions.filter(inst => inst.images.length >= 1).length
const uploadRate = userInstitutions.length > 0 const uploadRate = userInstitutions.length > 0
? Math.round((uploadedCount / userInstitutions.length) * 100) ? Math.round((uploadedCount / userInstitutions.length) * 100)
: 0 : 0
...@@ -1356,21 +1356,19 @@ const getImageCountTagType = (count) => { ...@@ -1356,21 +1356,19 @@ const getImageCountTagType = (count) => {
} }
/** /**
* 获取机构得分 * 获取机构得分(二元计分)
*/ */
const getInstitutionScore = (imageCount) => { const getInstitutionScore = (imageCount) => {
if (imageCount === 0) return '0' if (imageCount === 0) return '0' // 0张图片 = 0分
if (imageCount === 1) return '0.5' return '1' // 1张及以上图片 = 1分
return '1'
} }
/** /**
* 获取机构互动得分 * 获取机构互动得分(二元计分)
*/ */
const getInstitutionInteractionScore = (imageCount) => { const getInstitutionInteractionScore = (imageCount) => {
if (imageCount === 0) return '0' if (imageCount === 0) return '0' // 0张图片 = 0分
if (imageCount === 1) return '0.5' return '1' // 1张及以上图片 = 1分
return '1'
} }
/** /**
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<div class="score-card"> <div class="score-card">
<div class="score-title">已传机构数</div> <div class="score-title">已传机构数</div>
<div class="score-value">{{ uploadedInstitutionsCount }}</div> <div class="score-value">{{ uploadedInstitutionsCount }}</div>
<div class="score-desc">已上传至少2张图片的机构数量</div> <div class="score-desc">已上传至少1张图片的机构数量</div>
</div> </div>
</el-col> </el-col>
<el-col :span="12"> <el-col :span="12">
...@@ -265,10 +265,10 @@ const filteredInstitutions = computed(() => { ...@@ -265,10 +265,10 @@ const filteredInstitutions = computed(() => {
}) })
/** /**
* 计算属性:已传机构数(至少2张图片才算完成 * 计算属性:已传机构数(至少1张图片才算完成,与二元计分算法一致
*/ */
const uploadedInstitutionsCount = computed(() => { const uploadedInstitutionsCount = computed(() => {
return userInstitutions.value.filter(inst => inst.images && inst.images.length >= 2).length return userInstitutions.value.filter(inst => inst.images && inst.images.length >= 1).length
}) })
/** /**
......
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