Skip to content

Commit

Permalink
Update timestamp when modifying a project (#1337)
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano authored Mar 25, 2024
1 parent db0bcf4 commit 5566e6c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/commands/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ export async function createProject(node: NodeBase | undefined, api?: AtelierAPI
if (desc !== undefined) {
try {
// Create the project
await api.actionQuery("INSERT INTO %Studio.Project (Name,Description) VALUES (?,?)", [name, desc]);
await api.actionQuery("INSERT INTO %Studio.Project (Name,Description,LastModified) VALUES (?,?,NOW())", [
name,
desc,
]);
} catch (error) {
let message = `Failed to create project '${name}'.`;
if (error && error.errorText && error.errorText !== "") {
Expand Down Expand Up @@ -910,6 +913,12 @@ export async function modifyProject(
[]
);
}
if (add.length || remove.length) {
// Update the project's timestamp
await api.actionQuery("UPDATE %Studio.Project SET LastModified = NOW() WHERE Name = ?", [project]).catch(() => {
// Swallow error because VS Code doesn't care about the timestamp
});
}
} catch (error) {
let message = `Failed to modify project '${project}'.`;
if (error && error.errorText && error.errorText !== "") {
Expand Down Expand Up @@ -1118,6 +1127,11 @@ export async function addIsfsFileToProject(
.join(" UNION ")})`,
[]
);

// Update the project's timestamp
await api.actionQuery("UPDATE %Studio.Project SET LastModified = NOW() WHERE Name = ?", [project]).catch(() => {
// Swallow error because VS Code doesn't care about the timestamp
});
}
} catch (error) {
let message = `Failed to modify project '${project}'.`;
Expand Down Expand Up @@ -1223,7 +1237,10 @@ export async function modifyProjectMetadata(nodeOrUri: NodeBase | vscode.Uri | u
}

// Modify the project
await api.actionQuery("UPDATE %Studio.Project SET Description = ? WHERE Name = ?", [newDesc, project]);
await api.actionQuery("UPDATE %Studio.Project SET Description = ?, LastModified = NOW() WHERE Name = ?", [
newDesc,
project,
]);

// Refesh the explorer
projectsExplorerProvider.refresh();
Expand Down
6 changes: 6 additions & 0 deletions src/explorer/explorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ export function registerExplorerOpen(): vscode.Disposable {
`${prjFileName}${prjType}`.toLowerCase(),
]);
}
// Update the project's timestamp
await api
.actionQuery("UPDATE %Studio.Project SET LastModified = NOW() WHERE Name = ?", [project])
.catch(() => {
// Swallow error because VS Code doesn't care about the timestamp
});
} catch (error) {
let message = `Failed to remove '${fullName}' from project '${project}'.`;
if (error && error.errorText && error.errorText !== "") {
Expand Down

0 comments on commit 5566e6c

Please sign in to comment.