mirror of
https://github.com/rzmk/learnhouse.git
synced 2025-12-19 04:19:25 +00:00
fix: remove testing leftovers
This commit is contained in:
parent
b564c8db64
commit
c7061a26fa
16 changed files with 30 additions and 71 deletions
38
app.py
38
app.py
|
|
@ -64,45 +64,7 @@ app.mount("/content", StaticFiles(directory="content"), name="content")
|
|||
app.include_router(v1_router)
|
||||
|
||||
# General Routes
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def root():
|
||||
return {"Message": "Welcome to LearnHouse ✨"}
|
||||
|
||||
|
||||
@app.get("/test")
|
||||
async def rootd(request: Request):
|
||||
res = await authorization_verify_based_on_roles(
|
||||
request=request,
|
||||
user_id="user_c441e47e-5c04-4b03-9886-b0f5cb333c06",
|
||||
action="read",
|
||||
roles_list=[
|
||||
UserRolesInOrganization(
|
||||
org_id="org_e7085838-2efc-48f3-b414-77318572d9f5", role_id="role_admin"
|
||||
),
|
||||
],
|
||||
element_id="collection_1c277b46-5a4b-440a-ac29-94b874ef7cf4",
|
||||
)
|
||||
return res
|
||||
|
||||
|
||||
@app.get("/test2")
|
||||
async def rootds(request: Request):
|
||||
res = await authorization_verify_if_user_is_author(
|
||||
request=request,
|
||||
user_id="user_c441e47e-5c04-4b03-9886-b0f5cb333c06",
|
||||
action="read",
|
||||
element_id="course_1c277b46-5a4b-440a-ac29-94b874ef7cf4",
|
||||
)
|
||||
return res
|
||||
|
||||
@app.get("/test3")
|
||||
async def rootdsc(request: Request):
|
||||
res = await authorization_verify_if_element_is_public(
|
||||
request=request,
|
||||
user_id="anonymous",
|
||||
action="read",
|
||||
element_id="course_1c277b46-5a4b-440a-ac29-94b874ef7cf4",
|
||||
)
|
||||
return res
|
||||
|
|
@ -61,7 +61,7 @@ function AccountCreation() {
|
|||
},
|
||||
validate,
|
||||
onSubmit: values => {
|
||||
console.log(install.data[1].slug)
|
||||
|
||||
let finalvalues = { ...values, org_slug: install.data[1].slug }
|
||||
let finalvalueswithoutpasswords = { ...values, password: '', confirmPassword: '', org_slug: install.data[1].slug }
|
||||
let install_data = { ...install.data, 3: finalvalues }
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ function DefaultElements() {
|
|||
setIsSubmitted(true)
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ const Finish = () => {
|
|||
const router = useRouter()
|
||||
|
||||
async function finishInstall() {
|
||||
console.log('install_data')
|
||||
|
||||
let install_data = { ...install.data, 5: { status: 'OK' } }
|
||||
|
||||
let data = await updateInstall(install_data, 6)
|
||||
|
|
@ -19,7 +19,7 @@ const Finish = () => {
|
|||
router.push('/install?step=6')
|
||||
}
|
||||
else {
|
||||
console.log('Error')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ function OrgCreation() {
|
|||
setIsSubmitted(true)
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ function SampleData() {
|
|||
try {
|
||||
let username = install.data[3].username
|
||||
let slug = install.data[1].slug
|
||||
console.log(install.data)
|
||||
|
||||
createSampleDataInstall(username, slug)
|
||||
|
||||
let install_data = { ...install.data, 4: { status: 'OK' } }
|
||||
|
|
@ -24,7 +24,7 @@ function SampleData() {
|
|||
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const Organizations = () => {
|
|||
|
||||
const handleSubmit = async (e: any) => {
|
||||
e.preventDefault();
|
||||
console.log({ name, description, email });
|
||||
|
||||
let logo = ''
|
||||
const status = await createNewOrganization({ name, description, email, logo, slug, default: false });
|
||||
alert(JSON.stringify(status));
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ export async function generateMetadata(
|
|||
const org = await getOrganizationContextInfo(params.orgslug, { revalidate: 1800, tags: ['organizations'] });
|
||||
const col = await getCollectionByIdWithAuthHeader(params.collectionid, access_token_cookie ? access_token_cookie.value : null, { revalidate: 0, tags: ['collections'] });
|
||||
|
||||
console.log(col)
|
||||
|
||||
|
||||
return {
|
||||
title: `Collection : ${col.name} — ${org.name}`,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function NewCollection(params: any) {
|
|||
|
||||
const handleSubmit = async (e: any) => {
|
||||
e.preventDefault();
|
||||
console.log("selectedCourses", selectedCourses);
|
||||
|
||||
const collection = {
|
||||
name: name,
|
||||
description: description,
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ function CourseEdit(params: any) {
|
|||
|
||||
// Submit new activity
|
||||
const submitActivity = async (activity: any) => {
|
||||
console.log("submitActivity", activity);
|
||||
|
||||
let org = await getOrganizationContextInfo(orgslug, { revalidate: 1800 });
|
||||
await updateChaptersMetadata(courseid, data);
|
||||
await createActivity(activity, activity.chapterId, org.org_id);
|
||||
|
|
@ -105,7 +105,7 @@ function CourseEdit(params: any) {
|
|||
|
||||
// Submit YouTube Video Upload
|
||||
const submitExternalVideo = async (external_video_data: any, activity: any, chapterId: string) => {
|
||||
console.log("submitExternalVideo", external_video_data);
|
||||
|
||||
await updateChaptersMetadata(courseid, data);
|
||||
await createExternalVideoActivity(external_video_data, activity, chapterId);
|
||||
await getCourseChapters();
|
||||
|
|
@ -115,7 +115,7 @@ function CourseEdit(params: any) {
|
|||
};
|
||||
|
||||
const deleteChapterUI = async (chapterId: any) => {
|
||||
console.log("deleteChapter", chapterId);
|
||||
|
||||
await deleteChapter(chapterId);
|
||||
getCourseChapters();
|
||||
revalidateTags(['courses'], orgslug);
|
||||
|
|
@ -123,7 +123,7 @@ function CourseEdit(params: any) {
|
|||
};
|
||||
|
||||
const updateChapters = () => {
|
||||
console.log(data);
|
||||
|
||||
updateChaptersMetadata(courseid, data);
|
||||
revalidateTags(['courses'], orgslug);
|
||||
router.refresh();
|
||||
|
|
@ -134,7 +134,7 @@ function CourseEdit(params: any) {
|
|||
*/
|
||||
|
||||
const openNewActivityModal = async (chapterId: any) => {
|
||||
console.log("openNewActivityModal", chapterId);
|
||||
|
||||
setNewActivityModal(true);
|
||||
setNewActivityModalData(chapterId);
|
||||
};
|
||||
|
|
@ -145,7 +145,7 @@ function CourseEdit(params: any) {
|
|||
};
|
||||
|
||||
const closeNewActivityModal = () => {
|
||||
console.log("closeNewActivityModal");
|
||||
|
||||
|
||||
setNewActivityModal(false);
|
||||
};
|
||||
|
|
@ -156,7 +156,7 @@ function CourseEdit(params: any) {
|
|||
*/
|
||||
const onDragEnd = (result: any) => {
|
||||
const { destination, source, draggableId, type } = result;
|
||||
console.log(result);
|
||||
|
||||
|
||||
// check if the activity is dropped outside the droppable area
|
||||
if (!destination) {
|
||||
|
|
@ -177,7 +177,7 @@ function CourseEdit(params: any) {
|
|||
...data,
|
||||
chapterOrder: newChapterOrder,
|
||||
};
|
||||
console.log(newState);
|
||||
|
||||
|
||||
setData(newState);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ import { updatePassword } from '@services/settings/password';
|
|||
function PasswordsClient() {
|
||||
const auth: any = React.useContext(AuthContext);
|
||||
|
||||
console.log('auth', auth)
|
||||
|
||||
|
||||
const updatePasswordUI = async (values: any) => {
|
||||
let user_id = auth.userInfo.user_object.user_id;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ function ImageBlockComponent(props: any) {
|
|||
let modifiedQuestions = [...questions];
|
||||
modifiedQuestions.splice(index, 1);
|
||||
setQuestions(modifiedQuestions);
|
||||
console.log(questions);
|
||||
|
||||
|
||||
// remove the answers from the answers array
|
||||
let modifiedAnswers = [...answers];
|
||||
|
|
@ -79,17 +79,17 @@ function ImageBlockComponent(props: any) {
|
|||
option_id: option_id,
|
||||
};
|
||||
setAnswers([...answers, answer]);
|
||||
console.log(answers);
|
||||
|
||||
};
|
||||
|
||||
const saveQuiz = async () => {
|
||||
// save the questions and answers to the backend
|
||||
console.log("saving quiz");
|
||||
console.log(questions);
|
||||
console.log(answers);
|
||||
|
||||
|
||||
|
||||
try {
|
||||
let res = await submitQuizBlock(props.extension.options.activity.activity_id, {questions : questions , answers : answers})
|
||||
console.log(res.block_id);
|
||||
|
||||
props.updateAttributes({
|
||||
quizId: {
|
||||
value : res.block_id
|
||||
|
|
@ -98,7 +98,7 @@ function ImageBlockComponent(props: any) {
|
|||
|
||||
}
|
||||
catch (error) {
|
||||
console.log(error);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -112,9 +112,9 @@ function ImageBlockComponent(props: any) {
|
|||
|
||||
React.useEffect(() => {
|
||||
// fetch the questions and options from the backend
|
||||
console.log("fetching questions");
|
||||
console.log(questions);
|
||||
console.log(answers);
|
||||
|
||||
|
||||
|
||||
}, [questions, answers]);
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ function NewChapterModal({ submitChapter, closeModal }: any) {
|
|||
|
||||
const handleSubmit = async (e: any) => {
|
||||
e.preventDefault();
|
||||
console.log({ chapterName, chapterDescription });
|
||||
|
||||
setIsSubmitting(true);
|
||||
await submitChapter({ name: chapterName, description: chapterDescription, activities: [] });
|
||||
setIsSubmitting(false);
|
||||
|
|
|
|||
|
|
@ -173,7 +173,6 @@ async def get_collections(
|
|||
):
|
||||
collections = request.app.db["collections"]
|
||||
|
||||
print(org_id)
|
||||
|
||||
if current_user.user_id == "anonymous":
|
||||
all_collections = collections.find(
|
||||
|
|
|
|||
|
|
@ -204,7 +204,6 @@ async def create_initial_data(request: Request):
|
|||
activities=[],
|
||||
)
|
||||
coursechapter = await create_coursechapter(request,coursechapter, course_id, current_user)
|
||||
pprint(coursechapter)
|
||||
if coursechapter:
|
||||
# create activities
|
||||
for i in range(0, 5):
|
||||
|
|
|
|||
|
|
@ -364,7 +364,6 @@ async def create_sample_data(org_slug: str, username: str, request: Request):
|
|||
|
||||
current_user = PublicUser(**user)
|
||||
|
||||
print(current_user)
|
||||
for i in range(0, 5):
|
||||
# get image in BinaryIO format from unsplash and save it to disk
|
||||
image = requests.get("https://source.unsplash.com/random/800x600")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue