Skip to content

Feature/nathen418/populate db from api #104

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

Open
wants to merge 28 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
8556248
add typedoc
schiltz3 Jan 9, 2023
224ad99
example
schiltz3 Jan 9, 2023
6c32401
Merge branch 'staging' into feature/typedoc
schiltz3 Jan 9, 2023
c9e186e
start work on updateDB command
nathen418 Jan 15, 2023
ae62706
Merge branch 'staging' into feature/nathen418/populate-db-from-api
nathen418 Jan 18, 2023
0e4c2f5
progress
nathen418 Jan 18, 2023
fafac95
Apply auto formatting changes
nathen418 Jan 18, 2023
ef5b84e
documentation
nathen418 Jan 20, 2023
68022c0
Merge branch 'feature/nathen418/populate-db-from-api' of https://gith…
nathen418 Jan 20, 2023
5a9cdcd
fix command name
nathen418 Jan 20, 2023
bac4b34
progress, edit required class fields
nathen418 Jan 20, 2023
b80eff6
Remove typedoc file parts
nathen418 Jan 20, 2023
24adda7
Apply auto formatting changes
nathen418 Jan 20, 2023
0dad2af
update db
schiltz3 Jan 20, 2023
989f3e4
clean up course_cleaning
schiltz3 Jan 20, 2023
049302f
add return type
schiltz3 Jan 20, 2023
d1167e8
add comment
schiltz3 Jan 20, 2023
4a65cc4
reduce number of database edits
schiltz3 Jan 20, 2023
3a4313d
reduce database saves again
schiltz3 Jan 20, 2023
e6b8264
update db (#105)
nathen418 Jan 20, 2023
60e0ecd
Apply auto formatting changes
nathen418 Jan 20, 2023
6553f6d
ds and add an interaction reply
nathen418 Jan 20, 2023
70fb5bd
Apply auto formatting changes
nathen418 Jan 20, 2023
134c975
move getCourseName to course_cleaning
nathen418 Jan 20, 2023
abf3fb9
remove cleanCompSciString, move CleanCompSciTitle
nathen418 Jan 20, 2023
69a55f5
Merge branch 'feature/nathen418/populate-db-from-api' of https://gith…
nathen418 Jan 20, 2023
5f3c242
Apply auto formatting changes
nathen418 Jan 20, 2023
af72d55
Merge branch 'staging' into feature/nathen418/populate-db-from-api
schiltz3 Jan 21, 2023
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
2 changes: 1 addition & 1 deletion __tests__/utils/channels.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import {
cleanChannelString,
concatCategoryName,
moveChannel,
getCourseName,
getTopic,
} from "../../src/utils/channels";
import { expect, describe, it, beforeEach } from "@jest/globals";
import { Guild, GuildChannel } from "discord.js";
import { IClass } from "../../src/models/classModel";
import { getCourseName } from "../../src/utils/course_cleaning";

//cleanChannelString
describe("cleanChannelString", () => {
Expand Down
165 changes: 164 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
"main": "index.ts",
"scripts": {
"run": "ts-node src/index.ts",
"format": "prettier --write .",
"test": "jest"
"format": "prettier --write ."
},
"repository": {
"type": "git",
Expand All @@ -35,7 +34,6 @@
},
"devDependencies": {
"@jest/globals": "^29.3.1",
"jest": "^29.3.1",
"ts-jest": "^29.0.3"
"jest": "^29.3.1"
}
}
}
2 changes: 1 addition & 1 deletion src/commands/owner/csClassPoll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ICommand } from "wokcommands";
import { classModel, IClass } from "../../models/classModel";
import { checkForRoles, cleanRoleString } from "../../utils/roles";
import { sleep } from "../../utils/sleep";
import { getCourseName } from "../../utils/channels";
import { getCourseName } from "../../utils/course_cleaning";

// Splits any size list into lists of at most `max_list_len`
/**
Expand Down
3 changes: 2 additions & 1 deletion src/commands/owner/csCreateChannels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ import {
getCategory,
moveChannel,
concatCategoryName,
getTopic,
} from "../../utils/channels";
import { create_default_embed } from "../../utils/embeds";
import { cleanRoleString } from "../../utils/roles";
import { getCourseName, getTopic } from "../../utils/channels";
import { getCourseName } from "../../utils/course_cleaning";

export default {
name: "csCreateChannels",
Expand Down
17 changes: 6 additions & 11 deletions src/commands/owner/migrateDB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ import { ICommand } from "wokcommands";
import { classModel, IClass } from "../../models/classModel";
import { create_default_embed } from "../../utils/embeds";
import { Schema, Types, Document } from "mongoose";
import { cleanChannelString, getTopic } from "../../utils/channels";
import { cleanRoleString } from "../../utils/roles";
import {
getCourseName,
cleanChannelString,
getTopic,
} from "../../utils/channels";
import { cleanRoleString } from "../../utils/roles";
cleanCompSciTitle,
cleanCourseCode,
} from "../../utils/course_cleaning";
import Bottleneck from "bottleneck";

function cleanCompSciString(s: string): string {
return s.toLowerCase().replace("compsci ", "cs").trim();
}
function cleanCompSciTitle(s: string): string {
return s.replace(/(?:advanced )?topics in computer science:/gim, "").trim();
}
function isDupe(name: string): number {
return name.search(/\(\d\)/);
}
Expand Down Expand Up @@ -76,7 +71,7 @@ export default {
// Remove the number
new_name = new_name.slice(0, is_dupe);
}
new_name = cleanCompSciString(new_name);
new_name = cleanCourseCode(new_name);
course.set("NAME", new_name);
// Remove UUID
console.log(chalk.yellow(`${code}\t${new_name}`));
Expand Down
Loading