Skip to content

Commit 4b2dc7f

Browse files
authored
Merge pull request #41 from singyichen/feat/dataset-analysis-table-refresh
refactor(task-management): remove export results section from task overview
2 parents 08cd39a + 6a104ac commit 4b2dc7f

24 files changed

Lines changed: 3097 additions & 330 deletions

design/prototype/pages/annotation/annotation-list.html

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,12 +1335,14 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
13351335
var runType = params.get('run_type');
13361336
var taskId = params.get('task_id');
13371337
var taskType = params.get('task_type') || getStoredActiveTaskType();
1338+
var subType = params.get('sub_type');
13381339

13391340
return {
13401341
role: role === 'reviewer' ? 'reviewer' : 'annotator',
13411342
runType: runType === 'official_run' ? 'official_run' : 'dry_run',
13421343
taskId: taskId ? taskId.trim() : '',
1343-
taskType: TASK_TYPE_META[taskType] ? taskType : 'single_sentence_classification'
1344+
taskType: TASK_TYPE_META[taskType] ? taskType : 'single_sentence_classification',
1345+
subType: subType ? subType.trim() : ''
13441346
};
13451347
}
13461348

@@ -1390,12 +1392,20 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
13901392
return false;
13911393
}
13921394

1395+
function matchesTaskContext(task, context) {
1396+
if (!task) return false;
1397+
if (context.runType && task.runType !== context.runType) return false;
1398+
if (context.taskId && !matchesTaskId(task, context.taskId)) return false;
1399+
if (context.taskType && task.taskType !== context.taskType) return false;
1400+
if (context.subType && (task.subType || '') !== context.subType) return false;
1401+
return true;
1402+
}
1403+
13931404
function findCurrentTask(context) {
13941405
var roleTasks = TASKS_BY_ROLE[context.role] || [];
13951406
for (var i = 0; i < roleTasks.length; i += 1) {
13961407
var task = roleTasks[i];
1397-
if (!matchesTaskId(task, context.taskId)) continue;
1398-
if (context.runType && task.runType !== context.runType) continue;
1408+
if (!matchesTaskContext(task, context)) continue;
13991409
return task;
14001410
}
14011411
return null;
@@ -1413,16 +1423,13 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
14131423
return (TASK_TYPE_META[taskType] && TASK_TYPE_META[taskType].badgeClass) || 'badge-task-type-default';
14141424
}
14151425

1416-
function findLatestUnfinishedSampleId(task) {
1426+
function findFirstNonSubmittedSampleId(task) {
14171427
if (!task || !Array.isArray(task.samples) || task.samples.length === 0) return '';
14181428

1419-
for (var i = task.samples.length - 1; i >= 0; i -= 1) {
1420-
if (task.samples[i].status === 'pending') return task.samples[i].sampleId;
1421-
}
1422-
for (var j = task.samples.length - 1; j >= 0; j -= 1) {
1423-
if (task.samples[j].status === 'saved') return task.samples[j].sampleId;
1429+
for (var i = 0; i < task.samples.length; i += 1) {
1430+
if (task.samples[i].status !== 'submitted') return task.samples[i].sampleId;
14241431
}
1425-
return task.samples[task.samples.length - 1].sampleId;
1432+
return task.samples[0].sampleId;
14261433
}
14271434

14281435
function buildWorkspaceUrl(taskId, sampleId, role, runType, taskType, subType) {
@@ -1470,7 +1477,7 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
14701477
if (quickBtn) {
14711478
quickBtn.textContent = context.role === 'reviewer' ? '快速審核' : '快速繼續';
14721479
quickBtn.onclick = function () {
1473-
var sampleId = findLatestUnfinishedSampleId(task);
1480+
var sampleId = findFirstNonSubmittedSampleId(task);
14741481
if (!sampleId) return;
14751482
setStoredActiveTaskType(task.taskType);
14761483
window.location.href = buildWorkspaceUrl(task.taskId, sampleId, context.role, task.runType, task.taskType, task.subType);
@@ -1674,9 +1681,7 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
16741681
var roleTasks = TASKS_BY_ROLE[context.role] || [];
16751682
var completionMap = readCompletionStateMap();
16761683
var filteredTasks = roleTasks.filter(function (task) {
1677-
if (!matchesTaskId(task, context.taskId)) return false;
1678-
if (context.runType && task.runType !== context.runType) return false;
1679-
return true;
1684+
return matchesTaskContext(task, context);
16801685
});
16811686

16821687
var flatRows = [];
@@ -1747,7 +1752,7 @@ <h1 class="page-title" id="pageTitle">標記清單</h1>
17471752
var roleTasks = TASKS_BY_ROLE['reviewer'] || [];
17481753
var allDecided = true;
17491754
roleTasks.forEach(function(task) {
1750-
if (!matchesTaskId(task, context.taskId)) return;
1755+
if (!matchesTaskContext(task, context)) return;
17511756
(task.samples || []).forEach(function(sample) {
17521757
(sample.annotators || []).forEach(function(ann, idx) {
17531758
var state = REVIEW_STATES[reviewKey(sample.sampleId, idx)];

0 commit comments

Comments
 (0)