Skip to content
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

feat: teacher views dashboard #173

Merged
merged 19 commits into from
Sep 15, 2023
Merged

Conversation

cewei8483
Copy link
Contributor

@cewei8483 cewei8483 commented Sep 5, 2023

This change is Reviewable

Copy link
Contributor

@KamilPawel KamilPawel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 7 of 11 files at r1, 4 of 4 files at r2, all commit messages.
Reviewable status: all files reviewed, 11 unresolved discussions (waiting on @cewei8483)


backend/portal/views/teacher/dashboard.py line 256 at r2 (raw file):

    form_data = request.POST
    invite_teacher_form = InviteTeacherForm(request.POST)

Why not use the form_data in the InviteTeacherForm 🤔


backend/portal/views/teacher/dashboard.py line 294 at r2 (raw file):

    if teacher == user or (teacher.school != user.school or not user.is_admin):
        return False

return True 😂


backend/portal/views/teacher/dashboard.py line 505 at r2 (raw file):

    Check student is awaiting decision on request
    """
    if not student.pending_class_request:

I don't know if we should do the same here with only returning either a boolean or a HttpResponse? Feels a bit odd.. since we are just transferring the logic it could be fine I guess


frontend/src/app/api/organisation.ts line 33 at r2 (raw file):

    }),
    leaveOrganisation: build.mutation<{
      source?: string;

Is this to check how was the invite sent?


frontend/src/pages/teacherDashboard/YourSchool.tsx line 122 at r2 (raw file):

const UpdateSchoolDetailsForm: React.FC<{
  schoolData: any;

Can we please define the type 😅


frontend/src/pages/teacherDashboard/YourSchool.tsx line 314 at r2 (raw file):

}> = ({ isUserAdmin, teachersData, sentInvites }) => {
  // const { email } = getUser();
  const email = 'alberteinstein@codeforlife.com';

Can this not be pulled from the API?


frontend/src/pages/teacherDashboard/YourSchool.tsx line 400 at r2 (raw file):

const YourSchool: React.FC<{
  data: any;

Here as well


frontend/src/pages/teacherDashboard/YourSchool.tsx line 413 at r2 (raw file):

        if (res?.classes) {
          navigate(paths.teacher.dashboard.school.leave._, {
            state: {

If we use Stefan's approach with { state: { index: , props: { children: [ ..... we do't need to redifine the page.notification


frontend/src/pages/teacherDashboard/YourSchool.tsx line 427 at r2 (raw file):

  return <>
    {location.state?.message &&

Then this can be removed


frontend/src/pages/teacherDashboard/classes/Classes.tsx line 237 at r2 (raw file):

  const findNewTeacherId = (name: string): number => {
    const t = teacherList.find((t: teacherListType) => (t.fullName === name));
    return t ? (t.id) : -1;

A bit more descriptive name please 😂


frontend/src/pages/teacherDashboard/classes/Classes.tsx line 322 at r2 (raw file):

    <>
      <Page.Notification>
        {location.state.source === 'organisationKick'

Can we not reuse the Stefan Notification as well?

Copy link
Contributor Author

@cewei8483 cewei8483 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 6 of 12 files reviewed, 11 unresolved discussions (waiting on @KamilPawel)


backend/portal/views/teacher/dashboard.py line 256 at r2 (raw file):

Previously, KamilPawel wrote…

Why not use the form_data in the InviteTeacherForm 🤔

Done.


backend/portal/views/teacher/dashboard.py line 294 at r2 (raw file):

Previously, KamilPawel wrote…

return True 😂

Done.


backend/portal/views/teacher/dashboard.py line 505 at r2 (raw file):

Previously, KamilPawel wrote…

I don't know if we should do the same here with only returning either a boolean or a HttpResponse? Feels a bit odd.. since we are just transferring the logic it could be fine I guess

This function is not used in this task, so I left it as it is.


frontend/src/app/api/organisation.ts line 33 at r2 (raw file):

Previously, KamilPawel wrote…

Is this to check how was the invite sent?

The endpoint will be called by two functions, organisationKick and leaveOrganisation. This variable is to distinguish them.


frontend/src/pages/teacherDashboard/YourSchool.tsx line 122 at r2 (raw file):

Previously, KamilPawel wrote…

Can we please define the type 😅

Done.


frontend/src/pages/teacherDashboard/YourSchool.tsx line 314 at r2 (raw file):

Previously, KamilPawel wrote…

Can this not be pulled from the API?

Done.


frontend/src/pages/teacherDashboard/YourSchool.tsx line 400 at r2 (raw file):

Previously, KamilPawel wrote…

Here as well

Done.


frontend/src/pages/teacherDashboard/YourSchool.tsx line 413 at r2 (raw file):

Previously, KamilPawel wrote…

If we use Stefan's approach with { state: { index: , props: { children: [ ..... we do't need to redifine the page.notification

As you said, the notification will then appear above the page banner


frontend/src/pages/teacherDashboard/YourSchool.tsx line 427 at r2 (raw file):

Previously, KamilPawel wrote…

Then this can be removed

Explained above


frontend/src/pages/teacherDashboard/classes/Classes.tsx line 237 at r2 (raw file):

Previously, KamilPawel wrote…

A bit more descriptive name please 😂

Done.


frontend/src/pages/teacherDashboard/classes/Classes.tsx line 322 at r2 (raw file):

Previously, KamilPawel wrote…

Can we not reuse the Stefan Notification as well?

Same reason above

Copy link
Contributor

@KamilPawel KamilPawel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 6 files at r3, 4 of 4 files at r4, 6 of 6 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @cewei8483)


frontend/src/app/api/teacher/dashboard.ts line 76 at r6 (raw file):

      providesTags: ['teacher']
    }),
    inviteTeacher: build.mutation<any, {

if the function doesn't need the attribute replace any with null, else define the type

Copy link
Contributor Author

@cewei8483 cewei8483 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 9 of 12 files reviewed, 1 unresolved discussion (waiting on @KamilPawel)


frontend/src/app/api/teacher/dashboard.ts line 76 at r6 (raw file):

Previously, KamilPawel wrote…

if the function doesn't need the attribute replace any with null, else define the type

Done.

Copy link
Contributor

@KamilPawel KamilPawel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r7, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @cewei8483)

@cewei8483 cewei8483 merged commit df0dbcb into development Sep 15, 2023
@cewei8483 cewei8483 deleted the teacher-views-dashboard branch September 15, 2023 14:58
faucomte97 pushed a commit to faucomte97/codeforlife-portal-backend that referenced this pull request Dec 17, 2024
# 1.0.0 (2024-12-06)

### Bug Fixes

* 105 new portal edits loginteacher ([ocadotechnology#113](ocadotechnology#113)) ([80339ed](ocadotechnology@80339ed))
* 2044 register page ([ocadotechnology#26](ocadotechnology#26)) ([78477e2](ocadotechnology@78477e2))
* 2045 home page ([ocadotechnology#6](ocadotechnology#6)) ([681e86e](ocadotechnology@681e86e))
* 2054 home learning page ([ocadotechnology#8](ocadotechnology#8)) ([5cbb7d5](ocadotechnology@5cbb7d5))
* 2059 http error pages ([ocadotechnology#9](ocadotechnology#9)) ([006f31f](ocadotechnology@006f31f))
* 91 new portal edits student  ([ocadotechnology#120](ocadotechnology#120)) ([3d2bab5](ocadotechnology@3d2bab5))
* 93 new portal edits teacherdashboardaccount ([ocadotechnology#123](ocadotechnology#123)) ([e27cea2](ocadotechnology@e27cea2))
* 99 new portal edit teacherdashboardclassesab123movestudentids=1 ([ocadotechnology#128](ocadotechnology#128)) ([6467467](ocadotechnology@6467467))
* about us page ([ocadotechnology#3](ocadotechnology#3)) ([4215826](ocadotechnology@4215826))
* add new logic ([ocadotechnology#79](ocadotechnology#79)) ([20ef876](ocadotechnology@20ef876))
* add NewsLetter page ([ocadotechnology#10](ocadotechnology#10)) ([656de69](ocadotechnology@656de69))
* add self as a media source ([ocadotechnology#121](ocadotechnology#121)) ([be6f39a](ocadotechnology@be6f39a))
* added padding teacher backup token ([ocadotechnology#141](ocadotechnology#141)) ([d589833](ocadotechnology@d589833))
* added spacings and the copy to clipboard functionality  ([ocadotechnology#127](ocadotechnology#127)) ([d95ca66](ocadotechnology@d95ca66))
* altered the padding to match prod ([ocadotechnology#138](ocadotechnology#138)) ([931c681](ocadotechnology@931c681))
* changed the header from 'Welcome' to 'Log in as a teacher' ([ocadotechnology#149](ocadotechnology#149)) ([6c4947f](ocadotechnology@6c4947f))
* CodingClub page ([ocadotechnology#5](ocadotechnology#5)) ([ba8f2d6](ocadotechnology@ba8f2d6))
* error pages ([22f0802](ocadotechnology@22f0802))
* fix padding ([ocadotechnology#129](ocadotechnology#129)) ([0a973e8](ocadotechnology@0a973e8)), closes [#1](https://github.com/ocadotechnology/codeforlife-portal-backend/issues/1)
* footer ([669e592](ocadotechnology@669e592))
* footer feedback ([fd618e2](ocadotechnology@fd618e2))
* general navigation ([01b7638](ocadotechnology@01b7638))
* get involved feedback ([1fb6d37](ocadotechnology@1fb6d37))
* get involved page ([ocadotechnology#4](ocadotechnology#4)) ([2a6a109](ocadotechnology@2a6a109))
* header ([bfdb306](ocadotechnology@bfdb306))
* home learning page feedback ([51295b8](ocadotechnology@51295b8))
* images contribute feedback ([55dfc63](ocadotechnology@55dfc63))
* install cfl package dev extra ([ocadotechnology#298](ocadotechnology#298)) ([552fbfe](ocadotechnology@552fbfe))
* new About us page edits ([ocadotechnology#104](ocadotechnology#104)) ([8226f01](ocadotechnology@8226f01))
* new portal edits - /student/dashboard/independent/join ([ocadotechnology#114](ocadotechnology#114)) ([1a47514](ocadotechnology@1a47514))
* new portal edits - /teacher/dashboard/account/setup-2fa ([ocadotechnology#119](ocadotechnology#119)) ([7c59b88](ocadotechnology@7c59b88))
* New portal edits - Header ([ocadotechnology#102](ocadotechnology#102)) ([0476c1a](ocadotechnology@0476c1a))
* new portal edits - table greys ([ocadotechnology#80](ocadotechnology#80)) ([845cba1](ocadotechnology@845cba1))
* New portal edits - teacher/2FA ([ocadotechnology#139](ocadotechnology#139)) ([beb2ac6](ocadotechnology@beb2ac6))
* padding and default ticked levels ([ocadotechnology#126](ocadotechnology#126)) ([0d7c5f9](ocadotechnology@0d7c5f9)), closes [ocadotechnology#2](ocadotechnology#2)
* pipeline tests ([9b8de6a](ocadotechnology@9b8de6a))
* spacing ([ocadotechnology#75](ocadotechnology#75)) ([4facbd8](ocadotechnology@4facbd8))
* themedbox and close menu on details button click ([078e968](ocadotechnology@078e968))
* tsconfig ([0afbb17](ocadotechnology@0afbb17))
* update cfl js package version ([ocadotechnology#148](ocadotechnology#148)) ([9664ec4](ocadotechnology@9664ec4))
* update password ([ocadotechnology#314](ocadotechnology#314)) ([52268fc](ocadotechnology@52268fc))
* Update URLs in cron jobs ([ocadotechnology#168](ocadotechnology#168)) ([7519ee0](ocadotechnology@7519ee0))
* use recursive path generator and normalize path attributes ([de837e8](ocadotechnology@de837e8))
* use recursive path generator and normalize path attributes ([ocadotechnology#38](ocadotechnology#38)) ([3137425](ocadotechnology@3137425))
* y overflow ([ce6fe5d](ocadotechnology@ce6fe5d))

### Features

* 158 teacher teach edit student details ([ocadotechnology#185](ocadotechnology#185)) ([1435e1f](ocadotechnology@1435e1f)), closes [#1](https://github.com/ocadotechnology/codeforlife-portal-backend/issues/1) [ocadotechnology#2](ocadotechnology#2) [ocadotechnology#2](ocadotechnology#2) [ocadotechnology#2](ocadotechnology#2) [ocadotechnology#3](ocadotechnology#3) [ocadotechnology#3](ocadotechnology#3) [ocadotechnology#4](ocadotechnology#4) [ocadotechnology#5](ocadotechnology#5) [ocadotechnology#5](ocadotechnology#5)
* 16 organisation views ([ocadotechnology#147](ocadotechnology#147)) ([2d8219f](ocadotechnology@2d8219f))
* 17 email views ([ocadotechnology#76](ocadotechnology#76)) ([15986b8](ocadotechnology@15986b8))
* 19 api views ([ocadotechnology#118](ocadotechnology#118)) ([7271f19](ocadotechnology@7271f19))
* 2039 teachers page ([ocadotechnology#32](ocadotechnology#32)) ([b2794e7](ocadotechnology@b2794e7))
* 2042 studnents page ([ocadotechnology#7](ocadotechnology#7)) ([a6fcab7](ocadotechnology@a6fcab7))
* 2055 privacy notice page ([ocadotechnology#34](ocadotechnology#34)) ([855fc66](ocadotechnology@855fc66))
* 2056 terms of use page ([ocadotechnology#31](ocadotechnology#31)) ([7fdc868](ocadotechnology@7fdc868))
* 2058 students + independents auth pages ([ocadotechnology#30](ocadotechnology#30)) ([20b6157](ocadotechnology@20b6157))
* 35 teachers onboarding ([ocadotechnology#36](ocadotechnology#36)) ([3f9213b](ocadotechnology@3f9213b))
* adapted home.py to work with our current frontend ([ocadotechnology#77](ocadotechnology#77)) ([628aebb](ocadotechnology@628aebb))
* added 3 tabs on teachers dashboard page ([ocadotechnology#29](ocadotechnology#29)) ([ad04ead](ocadotechnology@ad04ead))
* adding get-students-endpoint ([ocadotechnology#184](ocadotechnology#184)) ([f842ad7](ocadotechnology@f842ad7)), closes [#1](https://github.com/ocadotechnology/codeforlife-portal-backend/issues/1) [ocadotechnology#2](ocadotechnology#2)
* Bundle front end and add Django backend ([ocadotechnology#27](ocadotechnology#27)) ([48b1c95](ocadotechnology@48b1c95))
* cypress plus codecov ([ocadotechnology#2](ocadotechnology#2)) ([91dc301](ocadotechnology@91dc301))
* dotmailer views ([ocadotechnology#69](ocadotechnology#69)) ([24692fd](ocadotechnology@24692fd))
* integrated the score view for the students and student login ([ocadotechnology#150](ocadotechnology#150)) ([2bf397a](ocadotechnology@2bf397a)), closes [#1](https://github.com/ocadotechnology/codeforlife-portal-backend/issues/1)
* login page ([ocadotechnology#28](ocadotechnology#28)) ([638179a](ocadotechnology@638179a))
* otp deploy ([ocadotechnology#370](ocadotechnology#370)) ([46e68b3](ocadotechnology@46e68b3))
* page agnostic features ([ocadotechnology#37](ocadotechnology#37)) ([8eb3c9a](ocadotechnology@8eb3c9a))
* teacher student management ([ocadotechnology#42](ocadotechnology#42)) ([5521a95](ocadotechnology@5521a95))
* teacher teach delete class ([ocadotechnology#183](ocadotechnology#183)) ([f7f9ef9](ocadotechnology@f7f9ef9))
* teacher teach delete student ([ocadotechnology#186](ocadotechnology#186)) ([a71c881](ocadotechnology@a71c881))
* teacher views classes dashboard ([ocadotechnology#180](ocadotechnology#180)) ([985bcc1](ocadotechnology@985bcc1))
* teacher views dashboard ([ocadotechnology#173](ocadotechnology#173)) ([df0dbcb](ocadotechnology@df0dbcb))
* update details, delete account, disable 2fa ([ocadotechnology#179](ocadotechnology#179)) ([a4a8e59](ocadotechnology@a4a8e59)), closes [#1](https://github.com/ocadotechnology/codeforlife-portal-backend/issues/1) [ocadotechnology#2](ocadotechnology#2) [ocadotechnology#3](ocadotechnology#3) [ocadotechnology#3](ocadotechnology#3) [ocadotechnology#4](ocadotechnology#4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants