Skip to content

2.11.6 #137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## version 2.11.6

- 增加 WC326 数据
- 修复 获取题目列表时,异常弹出语言选择框问题
- 修复 文件创建顺序

## version 2.11.5

- BWC94 & WC324 & WC325 数据
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-leetcode-problem-rating",
"displayName": "LeetCode",
"description": "LeetCode 官方插件增强, 代码开源, 增加 LeetCode 题目难度分, 给个star吧, 球球了",
"version": "2.11.5",
"version": "2.11.6",
"author": "ccagml",
"publisher": "ccagml",
"license": "MIT",
Expand Down
44 changes: 44 additions & 0 deletions resources/data.json
Original file line number Diff line number Diff line change
Expand Up @@ -7666,6 +7666,17 @@
"ContestID_en": "Weekly Contest 178",
"ContestID_zh": "第 178 场周赛"
},
{
"Rating": 1649.7120733311,
"ID": 2523,
"Title": "Closest Prime Numbers in Range",
"TitleZH": "范围内最接近的两个质数",
"TitleSlug": "closest-prime-numbers-in-range",
"ContestSlug": "weekly-contest-326",
"ProblemIndex": "Q4",
"ContestID_en": "Weekly Contest 326",
"ContestID_zh": "第 326 场周赛"
},
{
"Rating": 1648.3540381514,
"ID": 2423,
Expand Down Expand Up @@ -8238,6 +8249,17 @@
"ContestID_en": "Weekly Contest 78",
"ContestID_zh": "第 78 场周赛"
},
{
"Rating": 1604.5128423093,
"ID": 2522,
"Title": "Partition String Into Substrings With Values at Most K",
"TitleZH": "将字符串分割成值不超过 K 的子字符串",
"TitleSlug": "partition-string-into-substrings-with-values-at-most-k",
"ContestSlug": "weekly-contest-326",
"ProblemIndex": "Q3",
"ContestID_en": "Weekly Contest 326",
"ContestID_zh": "第 326 场周赛"
},
{
"Rating": 1604.1602280047,
"ID": 2424,
Expand Down Expand Up @@ -10856,6 +10878,17 @@
"ContestID_en": "Weekly Contest 307",
"ContestID_zh": "第 307 场周赛"
},
{
"Rating": 1413.0376809608,
"ID": 2521,
"Title": "Distinct Prime Factors of Product of Array",
"TitleZH": "数组乘积中的不同质因数数目",
"TitleSlug": "distinct-prime-factors-of-product-of-array",
"ContestSlug": "weekly-contest-326",
"ProblemIndex": "Q2",
"ContestID_en": "Weekly Contest 326",
"ContestID_zh": "第 326 场周赛"
},
{
"Rating": 1412.3053230205,
"ID": 1823,
Expand Down Expand Up @@ -13694,6 +13727,17 @@
"ContestID_en": "Biweekly Contest 77",
"ContestID_zh": "第 77 场双周赛"
},
{
"Rating": 1260.8697515006,
"ID": 2520,
"Title": "Count the Digits That Divide a Number",
"TitleZH": "统计能整除数字的位数",
"TitleSlug": "count-the-digits-that-divide-a-number",
"ContestSlug": "weekly-contest-326",
"ProblemIndex": "Q1",
"ContestID_en": "Weekly Contest 326",
"ContestID_zh": "第 326 场周赛"
},
{
"Rating": 1260.1755576607,
"ID": 1305,
Expand Down
20 changes: 11 additions & 9 deletions src/dao/bricksDao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ import { BricksType, BricksTypeName } from "../model/Model";
class BricksDao {
version = 1;
public async bricks_data_path() {
const language: string | undefined = await fetchProblemLanguage();
if (!language) {
return;
}
// const language: string | undefined = await fetchProblemLanguage();
// if (!language) {
// return;
// }
const workspaceFolder: string = await selectWorkspaceFolder(false);
if (!workspaceFolder) {
return;
Expand All @@ -40,17 +40,19 @@ class BricksDao {

let finalPath = path.join(lcpr_data_path, "bricks.json");
finalPath = useWsl() ? await toWinPath(finalPath) : finalPath;

if (!(await fse.pathExists(finalPath))) {
await fse.createFile(finalPath);
await fse.writeFile(finalPath, JSON.stringify({ version: this.version }));
}

return finalPath;
}
public async init() {
let lcpr_data_path = await this.bricks_data_path();
if (!lcpr_data_path) {
return;
}
if (!(await fse.pathExists(lcpr_data_path))) {
await fse.createFile(lcpr_data_path);
await fse.writeFile(lcpr_data_path, JSON.stringify({ version: this.version }));
}
}

private async _write_data(data: object) {
Expand All @@ -64,7 +66,7 @@ class BricksDao {
private async _read_data() {
let lcpr_data_path = await this.bricks_data_path();
if (!lcpr_data_path) {
return;
return {};
}
let temp_data = await fse.readFile(lcpr_data_path, "utf8");
return JSON.parse(temp_data) || {};
Expand Down
19 changes: 10 additions & 9 deletions src/dao/groupDao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import * as fse from "fs-extra";
class GroupDao {
version = 1;
public async group_data_path() {
const language: string | undefined = await fetchProblemLanguage();
if (!language) {
return;
}
// const language: string | undefined = await fetchProblemLanguage();
// if (!language) {
// return;
// }
const workspaceFolder: string = await selectWorkspaceFolder(false);
if (!workspaceFolder) {
return;
Expand All @@ -33,17 +33,18 @@ class GroupDao {

let finalPath = path.join(lcpr_data_path, "group.json");
finalPath = useWsl() ? await toWinPath(finalPath) : finalPath;

if (!(await fse.pathExists(finalPath))) {
await fse.createFile(finalPath);
await fse.writeFile(finalPath, JSON.stringify({ version: this.version }));
}
return finalPath;
}
public async init() {
let lcpr_data_path = await this.group_data_path();
if (!lcpr_data_path) {
return;
}
if (!(await fse.pathExists(lcpr_data_path))) {
await fse.createFile(lcpr_data_path);
await fse.writeFile(lcpr_data_path, JSON.stringify({ version: this.version }));
}
}

private async _write_data(data: object) {
Expand All @@ -57,7 +58,7 @@ class GroupDao {
private async _read_data() {
let lcpr_data_path = await this.group_data_path();
if (!lcpr_data_path) {
return;
return {};
}
let temp_data = await fse.readFile(lcpr_data_path, "utf8");
return JSON.parse(temp_data) || {};
Expand Down
8 changes: 4 additions & 4 deletions src/dao/remarkDao.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ import * as fse from "fs-extra";
class RemarkDao {
version = 1;
public async get_remark_dir_path() {
const language: string | undefined = await fetchProblemLanguage();
if (!language) {
return;
}
// const language: string | undefined = await fetchProblemLanguage();
// if (!language) {
// return;
// }
const workspaceFolder: string = await selectWorkspaceFolder(false);
if (!workspaceFolder) {
return;
Expand Down