Skip to content

Commit

Permalink
add print to understand where to change the code
Browse files Browse the repository at this point in the history
  • Loading branch information
CamilleLegeron committed Oct 12, 2023
1 parent d087f39 commit 1d7c807
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
5 changes: 5 additions & 0 deletions app/server/lib/ActiveDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2509,6 +2509,9 @@ export class ActiveDoc extends EventEmitter {
private async _fetchQueryFromDB(query: ServerQuery, onDemand: boolean): Promise<TableDataAction> {
// Expand query to compute formulas (or include placeholders for them).
const expandedQuery = expandQuery(query, this.docData!, onDemand);
console.log("--------------fetchQueryFromDB----------------------");
console.log(expandedQuery);
console.log(this.docData!);
const marshalled = await this.docStorage.fetchQuery(expandedQuery);
const table = this.docStorage.decodeMarshalledData(marshalled, query.tableId);

Expand All @@ -2523,6 +2526,8 @@ export class ActiveDoc extends EventEmitter {
}

private async _fetchQueryFromDataEngine(query: ServerQuery): Promise<TableDataAction> {
console.log("--------------_fetchQueryFromDataEngine----------------------");
console.log(await this._pyCall('fetch_table', query.tableId, true, query.filters));
return this._pyCall('fetch_table', query.tableId, true, query.filters);
}

Expand Down
11 changes: 9 additions & 2 deletions app/server/lib/DocApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ export class DocWorkerApi {
session, {tableId, filters}, !immediate));
// For metaTables we don't need to specify columns, search will infer it from the sort expression.
const isMetaTable = tableId.startsWith('_grist');
console.log("////////////////////////////// in getTableData");
console.log("---- tableData");
console.log(tableData);
const columns = isMetaTable ? null :
await handleSandboxError('', [], activeDoc.getTableCols(session, tableId, true));
const params = getQueryParameters(req);
Expand All @@ -217,9 +220,13 @@ export class DocWorkerApi {
}

async function getTableRecords(
activeDoc: ActiveDoc, req: RequestWithLogin, opts?: { optTableId?: string; includeHidden?: boolean }
activeDoc: ActiveDoc,
req: RequestWithLogin,
opts?: { optTableId?: string; includeHidden?: boolean, useColRef?: boolean }
): Promise<TableRecordValue[]> {
const columnData = await getTableData(activeDoc, req, opts?.optTableId);
console.log("------------------- colummnDATA in getTableRecords");
console.log(columnData);
const fieldNames = Object.keys(columnData).filter((k) => {
if (k === "id") {
return false;
Expand Down Expand Up @@ -257,7 +264,7 @@ export class DocWorkerApi {
this._app.get('/api/docs/:docId/tables/:tableId/records', canView,
withDoc(async (activeDoc, req, res) => {
const records = await getTableRecords(activeDoc, req,
{ includeHidden: isAffirmative(req.query.hidden) }
{ includeHidden: isAffirmative(req.query.hidden), useColRef: isAffirmative(req.query.use_col_ref) }
);
res.json({records});
})
Expand Down
1 change: 1 addition & 0 deletions sandbox/grist/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ def fetch_table(self, table_id, formulas=True, private=False, query=None):
"""
Returns TableData object representing all data in this table.
"""
print("Je suis dans le fichier de PYTHON YOUHOUUUUUUU", file=sys.stderr)
table = self.tables[table_id]
column_values = {}

Expand Down

0 comments on commit 1d7c807

Please sign in to comment.