Skip to content

Commit

Permalink
Fix undefined star
Browse files Browse the repository at this point in the history
  • Loading branch information
langningchen committed Dec 22, 2024
1 parent 996c9c7 commit b4cd0f6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ All notable changes to the "cyezoi" extension will be documented in this file.
## v0.0.34

- Fix grammar mistake
- Fix undefined star

Want to see the previous log? [Click here](https://github.com/CYEZOI/cyezoi-helper/commits/main/CHANGELOG.md)
2 changes: 1 addition & 1 deletion src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export const activate = async (context: vscode.ExtensionContext) => {
pid = await ensureData(pid?.toString(), 'pid', 'problem ID', vscode.window.activeTextEditor?.document.fileName.match(/\d+/)?.[0]);
if (!pid) { return; }
try {
const lastState = await new cyezFetch({ path: `/d/problemset/p/${pid}` }).start().then(response => response.json.psdoc.star);
const lastState = await new cyezFetch({ path: `/d/problemset/p/${pid}` }).start().then(response => response.json.psdoc?.star);
await new cyezFetch({
path: `/d/problemset/p/${pid}`,
body: {
Expand Down
2 changes: 1 addition & 1 deletion src/treeView/pTree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default class extends treeView<Problem | ProblemRecord> {

export class Problem extends vscode.TreeItem {
constructor(pdoc: utils.ProblemDoc, psdoc: utils.ProblemStatusDoc, tid?: string) {
super((psdoc && psdoc.star ? "★ " : "") + 'P' + pdoc.docId, (psdoc && psdoc.status ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None));
super((psdoc?.star ? "★ " : "") + 'P' + pdoc.docId, (psdoc && psdoc.status ? vscode.TreeItemCollapsibleState.Collapsed : vscode.TreeItemCollapsibleState.None));
this.id = (tid ? tid + '-' : '') + pdoc.docId;
this.contextValue = 'problem';
this.description = pdoc.title;
Expand Down

0 comments on commit b4cd0f6

Please sign in to comment.