Compare commits
6 Commits
fix/1117-j
...
chore/1117
| Author | SHA1 | Date | |
|---|---|---|---|
| 294833ccc5 | |||
| f48579d574 | |||
| c5a605ab1d | |||
| 517b3ee844 | |||
| 75aa931f85 | |||
| 2d4113e581 |
@@ -194,6 +194,7 @@ export class LegalApi {
|
|||||||
export interface CaseStatusEntry {
|
export interface CaseStatusEntry {
|
||||||
case_number: string;
|
case_number: string;
|
||||||
status: string;
|
status: string;
|
||||||
|
updated_at?: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface CaseSummary {
|
export interface CaseSummary {
|
||||||
|
|||||||
@@ -179,19 +179,13 @@ export default {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
jobs: [
|
jobs: [
|
||||||
{
|
// הושבת (legal-ai #1117, INV-INT9 — כותב יחיד ל-issue.status): הסנכרון עבר
|
||||||
jobKey: "sync-case-status",
|
// לצד-השרת (`_case_status_sync_loop` ב-legal-ai, CASE_STATUS_SYNC_MODE).
|
||||||
displayName: "Sync Legal Case Status",
|
// הסרה מההצהרה גורמת ל-Paperclip להעביר את הג'וב ל-`paused` בהתקנה הבאה.
|
||||||
description:
|
// ה-handler ב-worker.ts נשאר רשום אך לא יופעל.
|
||||||
"Polls legal-ai for case status changes and updates Paperclip issues",
|
// הושבת (legal-ai #1117, הוראת חיים): תיק ללא תנועה לעיתים הוא מכוון, והתזכורות
|
||||||
schedule: "*/15 * * * *",
|
// היו רעש בלבד. הסרה מההצהרה => Paperclip מעביר ל-`paused` בהתקנה הבאה.
|
||||||
},
|
// ה-handler ב-worker.ts נשאר רשום אך לא יופעל.
|
||||||
{
|
|
||||||
jobKey: "stale-case-reminder",
|
|
||||||
displayName: "תזכורת תיקים תקועים",
|
|
||||||
description: "מזהה תיקים שלא עודכנו 30+ ימים ומוסיף תגובה ל-issue",
|
|
||||||
schedule: "0 8 * * *",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
jobKey: "weekly-feedback-analysis",
|
jobKey: "weekly-feedback-analysis",
|
||||||
displayName: "ניתוח פידבק שבועי",
|
displayName: "ניתוח פידבק שבועי",
|
||||||
|
|||||||
@@ -1391,7 +1391,7 @@ const plugin = definePlugin({
|
|||||||
if (!caseNumber) return null;
|
if (!caseNumber) return null;
|
||||||
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
||||||
try {
|
try {
|
||||||
const resp = await ctx.http.fetch(
|
const resp = await fetchLegalApi(
|
||||||
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/legal-arguments`,
|
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/legal-arguments`,
|
||||||
);
|
);
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
@@ -1428,7 +1428,7 @@ const plugin = definePlugin({
|
|||||||
if (!caseNumber) return [];
|
if (!caseNumber) return [];
|
||||||
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
const apiBase = await resolveApiBase(ctx, companyIdOf(params));
|
||||||
try {
|
try {
|
||||||
const resp = await ctx.http.fetch(
|
const resp = await fetchLegalApi(
|
||||||
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/precedents`,
|
`${apiBase}/api/cases/${encodeURIComponent(caseNumber)}/precedents`,
|
||||||
);
|
);
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
@@ -1467,7 +1467,7 @@ const plugin = definePlugin({
|
|||||||
const url = new URL(`${apiBase}/api/missing-precedents`);
|
const url = new URL(`${apiBase}/api/missing-precedents`);
|
||||||
url.searchParams.set("case_number", caseNumber);
|
url.searchParams.set("case_number", caseNumber);
|
||||||
url.searchParams.set("status", "open");
|
url.searchParams.set("status", "open");
|
||||||
const resp = await ctx.http.fetch(url.toString());
|
const resp = await fetchLegalApi(url.toString());
|
||||||
if (!resp.ok) {
|
if (!resp.ok) {
|
||||||
ctx.logger.warn("legal-case-missing-precedents: API error", {
|
ctx.logger.warn("legal-case-missing-precedents: API error", {
|
||||||
caseNumber,
|
caseNumber,
|
||||||
@@ -1488,13 +1488,13 @@ const plugin = definePlugin({
|
|||||||
|
|
||||||
ctx.data.register("legal-dashboard-stats", async () => {
|
ctx.data.register("legal-dashboard-stats", async () => {
|
||||||
try {
|
try {
|
||||||
const cases = await api.listCases();
|
const cases = await api.listCaseStatuses();
|
||||||
const byStatus: Record<string, number> = {};
|
const byStatus: Record<string, number> = {};
|
||||||
let weekActivity = 0;
|
let weekActivity = 0;
|
||||||
const weekAgoMs = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
const weekAgoMs = Date.now() - 7 * 24 * 60 * 60 * 1000;
|
||||||
for (const c of cases) {
|
for (const c of cases) {
|
||||||
byStatus[c.status] = (byStatus[c.status] ?? 0) + 1;
|
byStatus[c.status] = (byStatus[c.status] ?? 0) + 1;
|
||||||
const updated = (c as { updated_at?: string | null }).updated_at;
|
const updated = c.updated_at;
|
||||||
if (updated) {
|
if (updated) {
|
||||||
const t = Date.parse(updated);
|
const t = Date.parse(updated);
|
||||||
if (!Number.isNaN(t) && t >= weekAgoMs) weekActivity += 1;
|
if (!Number.isNaN(t) && t >= weekAgoMs) weekActivity += 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user