Skip to content

Commit

Permalink
Fix camera files being loaded.
Browse files Browse the repository at this point in the history
  • Loading branch information
Damnae committed Apr 7, 2024
1 parent c7b9eca commit 93fa778
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/common/datasource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,11 @@ export interface DataSourceTreeItem
url:string
}

export async function retrieveTree(path:string, commit:string, recursive?:boolean) : Promise<DataSourceTreeItem[]>
export async function retrieveTree(path:string, commit:string, recursive:boolean) : Promise<DataSourceTreeItem[]>
{
const request = `git/trees/${commit}:${path}?recursive=${recursive ?? false}`
let request = `git/trees/${commit}:${path}`
if (recursive) request += '?recursive=true'

const response = await retrieveJson(request, commit, true)
const tree = response?.tree as DataSourceTreeItem[]
if (!tree)
Expand Down
12 changes: 8 additions & 4 deletions src/sources/ability.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export interface TaskListTemplateConfig

export interface TaskContext
{
Type:TaskContextType
Abilities:
{
[key:string]: Ability
Expand Down Expand Up @@ -531,6 +532,7 @@ export async function getTaskContext(commitId:string, type:TaskContextType) : Pr
{
const context:TaskContext =
{
Type:type,
Abilities: {},
Modifiers: {},
TaskListTemplates: {},
Expand All @@ -542,7 +544,7 @@ export async function getTaskContext(commitId:string, type:TaskContextType) : Pr
mergeAbilityConfig(context, await getAbilities(commitId, path) as AbilityConfig)
else
{
const tree = await retrieveTree(path, commitId)
const tree = await retrieveTree(path, commitId, false)
for (const treePath of tree.map(t => t.path))
if (pathIsDataJson(treePath))
mergeAbilityConfig(context, await getAbilities(commitId, `${path}/${treePath}`) as AbilityConfig)
Expand All @@ -553,7 +555,7 @@ export async function getTaskContext(commitId:string, type:TaskContextType) : Pr
mergeModifierConfig(context, await getModifiers(commitId, path) as ModifierConfig)
else
{
const tree = await retrieveTree(path, commitId)
const tree = await retrieveTree(path, commitId, false)
for (const treePath of tree.map(t => t.path))
if (pathIsDataJson(treePath))
mergeModifierConfig(context, await getModifiers(commitId, `${path}/${treePath}`) as ModifierConfig)
Expand All @@ -564,7 +566,7 @@ export async function getTaskContext(commitId:string, type:TaskContextType) : Pr
mergeTaskListTemplateConfig(context, await getTaskListTemplates(commitId, path) as TaskListTemplateConfig)
else
{
const tree = await retrieveTree(path, commitId)
const tree = await retrieveTree(path, commitId, false)
for (const treePath of tree.map(t => t.path))
if (pathIsDataJson(treePath))
mergeTaskListTemplateConfig(context, await getTaskListTemplates(commitId, `${path}/${treePath}`) as TaskListTemplateConfig)
Expand All @@ -579,7 +581,9 @@ export async function getTaskContext(commitId:string, type:TaskContextType) : Pr

function pathIsDataJson(path:string) : boolean
{
return !path.endsWith('.layout.json') && path.endsWith('.json')
return path.endsWith('.json')
&& !path.endsWith('.layout.json')
&& !path.includes('/Camera/')
}

export function findTaskTemplate(templateName:string, expressionContext:ExpressionContext, taskContext:TaskContext) : TaskListTemplate | undefined
Expand Down

0 comments on commit 93fa778

Please sign in to comment.