Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Commit aa534fc

Browse files
committed
Merge branch '398-bug-i-cannot-parse-my-database-from-other-database'
2 parents 223ae58 + e330571 commit aa534fc

File tree

7 files changed

+20
-17
lines changed

7 files changed

+20
-17
lines changed

src/DatabaseView.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export class DatabaseView extends TextFileView implements HoverParent {
167167
// Obtain base information about columns
168168
this.columns = await obtainColumnsFromFolder(yamlColumns);
169169
this.rows = await adapterTFilesToRows(
170-
this.file.parent.path,
170+
this.file,
171171
this.columns,
172172
this.diskConfig.yaml.config,
173173
this.diskConfig.yaml.filters

src/automations/AutomationsHelper.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ import { FormulaGenerator } from "automations/FormulaGenerator";
33
import { AutomationError, showDBError } from "errors/ErrorTypes";
44

55
export async function obtainFormulasFromFolder(config: LocalSettings) {
6-
try {
7-
const generator = new FormulaGenerator(config);
8-
return await generator.generate_object();
9-
} catch (e) {
10-
showDBError(AutomationError.LoadFormulas, e);
11-
return {};
12-
}
6+
const generator = new FormulaGenerator(config);
7+
return await generator.generate_object();
138
}
149

src/automations/formula_functions/ScriptFunctions.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { IGenerateObject } from "automations/IGenerateObject";
33
import { get_tfiles_from_folder } from "helpers/FileManagement";
44
import { LocalSettings } from "cdm/SettingsModel";
55
import { LOGGER } from "services/Logger";
6+
import { AutomationError, showDBError } from "errors/ErrorTypes";
67

78
export class ScriptFunctions implements IGenerateObject {
89
constructor(private config: LocalSettings) { }
@@ -21,10 +22,17 @@ export class ScriptFunctions implements IGenerateObject {
2122

2223
for (const file of files) {
2324
if (file.extension.toLowerCase() === "js") {
24-
await this.load_script_function(
25-
file,
26-
script_functions
27-
);
25+
try {
26+
await this.load_script_function(
27+
file,
28+
script_functions
29+
);
30+
} catch (e) {
31+
showDBError({
32+
error: AutomationError.LoadFormulas.error,
33+
solution: `check your ${file.path} js file code`
34+
}, e);
35+
}
2836
}
2937
}
3038
return script_functions;

src/helpers/VaultManagement.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,13 @@ export function getNormalizedPath(path: string): NormalizedPath {
7373
* @param folderPath
7474
* @returns
7575
*/
76-
export async function adapterTFilesToRows(folderPath: string, columns: TableColumn[], ddbbConfig: LocalSettings, filters: FilterSettings): Promise<Array<RowDataType>> {
76+
export async function adapterTFilesToRows(dbFile: TFile, columns: TableColumn[], ddbbConfig: LocalSettings, filters: FilterSettings): Promise<Array<RowDataType>> {
77+
const folderPath = dbFile.parent.path;
7778
LOGGER.debug(`=> adapterTFilesToRows. folderPath:${folderPath}`);
7879
const rows: Array<RowDataType> = [];
7980

8081
let folderFiles = await sourceDataviewPages(folderPath, ddbbConfig, columns);
81-
folderFiles = folderFiles.where(p => !p[DatabaseCore.FRONTMATTER_KEY]);
82+
folderFiles = folderFiles.where(p => (p.file as any).path !== dbFile.path);
8283
// Config filters asociated with the database
8384
if (filters.enabled && filters.conditions.length > 0) {
8485
folderFiles = folderFiles.where(p => DataviewService.filter(filters.conditions, p, ddbbConfig));

src/services/DatabaseInfo.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export default class DatabaseInfo {
4949
}
5050

5151
this.yaml = response.yaml;
52-
//await this.saveOnDisk();
5352
LOGGER.info(`<=initDatabaseconfigYaml`);
5453
}
5554

src/services/MarkdownPostProcessorService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ export class PreviewDatabaseModeService {
135135
// Obtain base information about columns
136136
const columns = await obtainColumnsFromFolder(yamlColumns);
137137
const rows = await adapterTFilesToRows(
138-
dbFile.parent.path,
138+
dbFile,
139139
columns,
140140
databaseDisk.yaml.config,
141141
databaseDisk.yaml.filters

src/stateManagement/data/handlers/DataviewRefreshHandlerAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class DataviewRefreshHandlerAction extends AbstractTableAction<Da
99
const { set, view, implementation } = tableActionResponse;
1010
implementation.actions.dataviewRefresh = async (column: TableColumn[], ddbbConfig: LocalSettings, filterConfig: FilterSettings) => {
1111
const refreshedRows = await adapterTFilesToRows(
12-
view.file.parent.path,
12+
view.file,
1313
column,
1414
ddbbConfig,
1515
filterConfig

0 commit comments

Comments
 (0)