-
Notifications
You must be signed in to change notification settings - Fork 449
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
Dev: Add BIT user attributes to MS User #1074
Conversation
|
||
|
||
@unique | ||
class Timezone(Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this required? There should be something inbuilt to do the same thing. I know there is in java.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to refactoring this Timezone enum to a more efficient way if someone can pointed out an inbuilt package that is available out there. We can try to refactor the Timezone in the BIT repo first instead of here to see if it works coz BIT schema already the tests written for the endpoints that are using this Timezone enum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this enum we could do this it's an inbuilt package. But implementing this means that the tz package would have to be the same for all the application.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@epicadk , unfortunately, this zoneinfo
module only available for Python >= 3.9.
MS backend is still using Python 3.6 for gh-action, so the gh action build/test will fail unless we change this.
Also, this enum is currently used in BIT frontend in timezones.js as a constant so that we can provide the dropdown options to user to prevent them inserting timezone that doesn't fall within the accepted value of backend timezone enum (which is according to the pytz list). Do you have any suggestions how we do this if we refactor backend to zoneinfo
? What should we use as constant at the frontend?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll run a matrix build. I'll create an issue. Mentorship system runs fine on python version 3.9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mtreacy002 can you now use python 3.9 and use zoneinfo?
app/database/models/user.py
Outdated
} | ||
|
||
def __repr__(self): | ||
"""Returns the user's name and username. """ | ||
return f"User name {self.name} . Username is {self.username} ." | ||
"""Returns the user's name, username, whether or not they are an organization representative and their timezone. """ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requires approval from @isabelcosta
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep..., I actually think it won't be too much of a problem if we don't include the is_organization_rep
or Timezone
in here since they can be abstracted later once we grab the user data using GET /user
api call 🤔. I will just remove them for now 😁.
My approached in this PR was from an angle of a new contributor who has succesfully completed the local setup.
|
A tip for @isabelcosta and other reviewers you can the changes @mtreacy002 has made here |
@epicadk, there were soooo many other commits there included in this PR 😱. Must be because the |
I think they will yes. Also can you please add BIT to github actions? |
Done |
@epicadk, should I also add |
Codecov Report
@@ Coverage Diff @@
## bit #1074 +/- ##
==========================================
+ Coverage 92.90% 94.39% +1.48%
==========================================
Files 38 39 +1
Lines 2073 2623 +550
==========================================
+ Hits 1926 2476 +550
Misses 147 147
|
@epicadk , can you suggest what went wrong here? 🤔 |
Yup I think you can wait for this. |
Yup that's right. It's fine. |
@isabelcosta , I have resolved the conflict, can you please review again 😉 |
auch @mtreacy002 can you squash all these commits into one? I see an issue here, and I bet it's because of the way that I did the sync 🙈 |
Nope rebasing won't be possible. It would still show the error. |
@isabelcosta , do you still face the conflict on merging? Do you want me to try squash merge all the commits from my end? |
You could try but I'm guessing it would still show merge conflicts after squashing. What you could do is. Rebase them into a single commit and then merge the upstream branch. |
b726aa3
to
c5dd57c
Compare
Done, @isabelcosta and @epicadk , I've squashed and force-pushed the commits. Can you please check again if this still causing conflicts at your end when merging? |
Yeps this might work. |
@@ -14,7 +14,7 @@ def create_app(config_filename: str) -> Flask: | |||
|
|||
db.init_app(app) | |||
|
|||
migrate = Migrate(app, db) | |||
migrate = Migrate(app, db, render_as_batch=True) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does this do? 🤓
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - please adjust! ### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These comments from alembic can be removed right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isabelcosta , done 😉
|
@vj-codes , I remember you asked last time whether we need to add |
Yup seems like a nice idea. But maybe add it to |
@isabelcosta no other changes from my side, can this be merged? |
@mtreacy002 can you try to solve the merge conflicts please? Me, @vj-codes and @epicadk did some merges and branch recreation, and now that we added the matrix python version thing to GH Actions, there are conflicts. |
remove BIT attrributes from being returned in _repr_(self) remove unnecessary brackets Fix description add bit branch to github action fix black linting error Remove alembic auto-generated comments
e2c16ae
to
81f739c
Compare
I've solved the conflict @isabelcosta 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will approve and merge once it has 2 approvals.
Points raised:
- We discussed that, timezones will be refactored later, to come from
zoneinfo
module. - Instructions on how to run migrations should go to the README.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
Description
Adding BIT user attributes to MS User as the first step for full BIT-MS integration
Fixes #1073
Type of Change:
Code/Quality Assurance Only
How Has This Been Tested?
The local_data.db has successfully added BIT User specific attributes after running migration script.
Checklist:
Code/Quality Assurance Only