diff --git a/app.py b/app.py index ef5b7580..2801bcc6 100644 --- a/app.py +++ b/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 \ No newline at end of file diff --git a/front/app/install/steps/account_creation.tsx b/front/app/install/steps/account_creation.tsx index 7580d861..da86d22f 100644 --- a/front/app/install/steps/account_creation.tsx +++ b/front/app/install/steps/account_creation.tsx @@ -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 } diff --git a/front/app/install/steps/default_elements.tsx b/front/app/install/steps/default_elements.tsx index 04fe8a65..4387f7d3 100644 --- a/front/app/install/steps/default_elements.tsx +++ b/front/app/install/steps/default_elements.tsx @@ -28,7 +28,7 @@ function DefaultElements() { setIsSubmitted(true) } catch (e) { - console.log(e) + } } diff --git a/front/app/install/steps/finish.tsx b/front/app/install/steps/finish.tsx index fbedc19e..be6bbc0d 100644 --- a/front/app/install/steps/finish.tsx +++ b/front/app/install/steps/finish.tsx @@ -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') + } } diff --git a/front/app/install/steps/org_creation.tsx b/front/app/install/steps/org_creation.tsx index 58edc2d2..88b60c89 100644 --- a/front/app/install/steps/org_creation.tsx +++ b/front/app/install/steps/org_creation.tsx @@ -65,7 +65,7 @@ function OrgCreation() { setIsSubmitted(true) } catch (e) { - console.log(e) + } } diff --git a/front/app/install/steps/sample_data.tsx b/front/app/install/steps/sample_data.tsx index d89db078..c03cfcb2 100644 --- a/front/app/install/steps/sample_data.tsx +++ b/front/app/install/steps/sample_data.tsx @@ -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) + } } diff --git a/front/app/organizations/new/page.tsx b/front/app/organizations/new/page.tsx index df43c47b..31326904 100644 --- a/front/app/organizations/new/page.tsx +++ b/front/app/organizations/new/page.tsx @@ -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)); diff --git a/front/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx b/front/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx index 104ef05d..f0d77317 100644 --- a/front/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx +++ b/front/app/orgs/[orgslug]/(withmenu)/collection/[collectionid]/page.tsx @@ -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}`, diff --git a/front/app/orgs/[orgslug]/(withmenu)/collections/new/page.tsx b/front/app/orgs/[orgslug]/(withmenu)/collections/new/page.tsx index 560b6b37..abee6674 100644 --- a/front/app/orgs/[orgslug]/(withmenu)/collections/new/page.tsx +++ b/front/app/orgs/[orgslug]/(withmenu)/collections/new/page.tsx @@ -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, diff --git a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx index a46da824..b5a46b18 100644 --- a/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx +++ b/front/app/orgs/[orgslug]/(withmenu)/course/[courseid]/edit/page.tsx @@ -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; diff --git a/front/app/orgs/[orgslug]/settings/account/passwords/passwords.tsx b/front/app/orgs/[orgslug]/settings/account/passwords/passwords.tsx index c2254a34..1b231b70 100644 --- a/front/app/orgs/[orgslug]/settings/account/passwords/passwords.tsx +++ b/front/app/orgs/[orgslug]/settings/account/passwords/passwords.tsx @@ -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; diff --git a/front/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx b/front/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx index 295f20a4..9b1f3ec2 100644 --- a/front/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx +++ b/front/components/Objects/Editor/Extensions/Quiz/QuizBlockComponent.tsx @@ -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 ( diff --git a/front/components/Objects/Modals/Chapters/NewChapter.tsx b/front/components/Objects/Modals/Chapters/NewChapter.tsx index 3d4b563b..3ac0e95a 100644 --- a/front/components/Objects/Modals/Chapters/NewChapter.tsx +++ b/front/components/Objects/Modals/Chapters/NewChapter.tsx @@ -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); diff --git a/src/services/courses/collections.py b/src/services/courses/collections.py index 3829e079..05e133bf 100644 --- a/src/services/courses/collections.py +++ b/src/services/courses/collections.py @@ -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( diff --git a/src/services/dev/mocks/initial.py b/src/services/dev/mocks/initial.py index 6c2da907..0134a135 100644 --- a/src/services/dev/mocks/initial.py +++ b/src/services/dev/mocks/initial.py @@ -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): diff --git a/src/services/install/install.py b/src/services/install/install.py index b7eda69d..55a6e362 100644 --- a/src/services/install/install.py +++ b/src/services/install/install.py @@ -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")