Adjust European short trip heuristic from >3 days to >1 day to correctly detect when user has returned home from European trips. This fixes the April 29-30, 2023 case where the location incorrectly showed "Sankt Georg, Hamburg" instead of "Bristol" when the user was free (no events scheduled) after the foss-north trip ended on April 27. The previous logic required more than 3 days to pass before assuming return home from European countries, but for short European trips by rail/ferry, users typically return within 1-2 days. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
48 lines
1.7 KiB
TypeScript
48 lines
1.7 KiB
TypeScript
import type { AnySchema } from "../../types";
|
|
import type { SchemaObjCxt } from "..";
|
|
import { Code, Name } from "../codegen";
|
|
import { Type } from "../util";
|
|
import type { JSONType } from "../rules";
|
|
export interface SubschemaContext {
|
|
schema: AnySchema;
|
|
schemaPath: Code;
|
|
errSchemaPath: string;
|
|
topSchemaRef?: Code;
|
|
errorPath?: Code;
|
|
dataLevel?: number;
|
|
dataTypes?: JSONType[];
|
|
data?: Name;
|
|
parentData?: Name;
|
|
parentDataProperty?: Code | number;
|
|
dataNames?: Name[];
|
|
dataPathArr?: (Code | number)[];
|
|
propertyName?: Name;
|
|
jtdDiscriminator?: string;
|
|
jtdMetadata?: boolean;
|
|
compositeRule?: true;
|
|
createErrors?: boolean;
|
|
allErrors?: boolean;
|
|
}
|
|
export type SubschemaArgs = Partial<{
|
|
keyword: string;
|
|
schemaProp: string | number;
|
|
schema: AnySchema;
|
|
schemaPath: Code;
|
|
errSchemaPath: string;
|
|
topSchemaRef: Code;
|
|
data: Name | Code;
|
|
dataProp: Code | string | number;
|
|
dataTypes: JSONType[];
|
|
definedProperties: Set<string>;
|
|
propertyName: Name;
|
|
dataPropType: Type;
|
|
jtdDiscriminator: string;
|
|
jtdMetadata: boolean;
|
|
compositeRule: true;
|
|
createErrors: boolean;
|
|
allErrors: boolean;
|
|
}>;
|
|
export declare function getSubschema(it: SchemaObjCxt, { keyword, schemaProp, schema, schemaPath, errSchemaPath, topSchemaRef }: SubschemaArgs): SubschemaContext;
|
|
export declare function extendSubschemaData(subschema: SubschemaContext, it: SchemaObjCxt, { dataProp, dataPropType: dpType, data, dataTypes, propertyName }: SubschemaArgs): void;
|
|
export declare function extendSubschemaMode(subschema: SubschemaContext, { jtdDiscriminator, jtdMetadata, compositeRule, createErrors, allErrors }: SubschemaArgs): void;
|