streamby-core 0.43.1 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -19,6 +19,12 @@ function getDb() {
|
|
|
19
19
|
}
|
|
20
20
|
const SHOT_FIELDS = ['name', 'description', 'status', 'assignees', 'assetId', 'exportId', 'dueDate', 'order'];
|
|
21
21
|
const TASK_FIELDS = ['name', 'status', 'priority', 'assignee', 'dueDate', 'notes'];
|
|
22
|
+
const PRIORITY_RANK = { low: 1, medium: 2, high: 3 };
|
|
23
|
+
const summaryOf = (tasks) => {
|
|
24
|
+
const open = tasks.filter(t => t.status !== 'done');
|
|
25
|
+
const priority = open.reduce((top, t) => (t.priority && (PRIORITY_RANK[t.priority] ?? 0) > (top ? PRIORITY_RANK[top] : 0) ? t.priority : top), null);
|
|
26
|
+
return { done: tasks.length - open.length, total: tasks.length, priority };
|
|
27
|
+
};
|
|
22
28
|
function productionRouter(_config) {
|
|
23
29
|
const router = (0, express_1.Router)();
|
|
24
30
|
const Project = (0, manager_1.getModel)('projects');
|
|
@@ -148,7 +154,15 @@ function productionRouter(_config) {
|
|
|
148
154
|
.find({ sequenceId: seqId, projectId })
|
|
149
155
|
.sort({ order: 1, createdAt: 1 })
|
|
150
156
|
.toArray();
|
|
151
|
-
|
|
157
|
+
// Each shot with how its tasks go, as a board's card shows it: how many are done of how
|
|
158
|
+
// many, and the highest priority among those still open.
|
|
159
|
+
const tasks = shots.length
|
|
160
|
+
? await db.collection('production_tasks')
|
|
161
|
+
.find({ projectId, shotId: { $in: shots.map(sh => sh.id) } })
|
|
162
|
+
.project({ shotId: 1, status: 1, priority: 1 })
|
|
163
|
+
.toArray()
|
|
164
|
+
: [];
|
|
165
|
+
res.json({ shots: shots.map(sh => ({ ...sh, taskSummary: summaryOf(tasks.filter(t => t.shotId === sh.id)) })) });
|
|
152
166
|
}
|
|
153
167
|
catch (err) {
|
|
154
168
|
res.status(500).json({ message: err.message });
|