First try at adding the omit grade option. - #143
Conversation
pulling from remote#
…to username-hash Pulling from upstream master into username-hash.
Pulling from upstream.
Want to be able to delete local copy of username-hash branch.
Pull from upstream.
| prod = False if not args.prod else True | ||
|
|
||
| omitgrade = input( | ||
| "Enter omitgrade (True or False): ") if not args.omitgrade else args.omitgrade |
| account_pass = os.getenv('ACCOUNT_PASSWORD') | ||
|
|
||
| def run(username, password, school, phone): | ||
| def run(username, password, school, phone, omitgrade): |
| return self._number No newline at end of file | ||
| return self._number | ||
|
|
||
| def get_omitgrade(self): |
| self._school_code = school_code | ||
|
|
||
| def set_omitgrade(sef, omitgrade): | ||
| self._omitgrade = omitgrade |
| self._password = password | ||
| self._number = number | ||
| self._school_code = school_code | ||
| self._omitgrade = omitgrade; |
|
|
||
| class User(): | ||
| def __init__(self, username, password, number, school_code = None): | ||
| def __init__(self, username, password, number, school_code = None, omitgrade = False): |
There was a problem hiding this comment.
line too long (90 > 79 characters)
unexpected spaces around keyword / parameter equals
| if add_new_user_instance(username): | ||
| api = CUNYFirstAPI(username, password) | ||
| user = User(username, password, number, args.school.upper()) | ||
| user = User(username, password, number, args.school.upper(), omitgrade) |
| number = input( | ||
| "Enter phone number: ") if not args.phone else args.phone | ||
| omitgrade = input( | ||
| "Enter omitgrade (True or False): ") if not args.omitgrade else args.omitgrade |
| gpa.get_term_gpa())) .newline() .add( | ||
| "Your cumulative GPA is: {0}".format( | ||
| gpa.get_cumulative_gpa())) .newline() | ||
| if omitgrade == "False" || omitgrade != "True": |
There was a problem hiding this comment.
SyntaxError: invalid syntax
missing whitespace around operator
There was a problem hiding this comment.
python has the word "or" not ||
| Changelog: The list of classes which have had grade changes | ||
| ''' | ||
| def create_text_message(change_log): | ||
| def create_text_message(change_log, omitgrade): |
Generated by 🚫 Danger |
|
|
||
| class User(): | ||
| def __init__(self, username, password, number, school_code = None): | ||
| def __init__(self, username, password, number, school_code = None, omitgrade = "False"): |
There was a problem hiding this comment.
line too long (92 > 79 characters)
unexpected spaces around keyword / parameter equals
Huddie
left a comment
There was a problem hiding this comment.
Looks pretty good i'd say. Makes sense to me.
A few suggestions on naming. + We need omitgrades to be a boolean. String acting as a bool doesn't sound ideal.
|
|
||
| <input class="input input--full-width" type="text" name="phone" placeholder="Phone Number" required> | ||
| <br> | ||
| <input class="input" type="checkbox" name="omitgrade" value="True" >I only want a notification that my grades are available. The text can omit the actual grade I recieved.</input> |
There was a problem hiding this comment.
What do you think about either
- removing the last line and adding a footer that says: "The text will omit the actual grade you receive "
- Switching the wording to "The text should omit the actual grade I received"
| <br> | ||
| <input class="input" type="checkbox" name="omitgrade" value="True" >I only want a notification that my grades are available. The text can omit the actual grade I recieved.</input> | ||
| <br> | ||
| <!-- <input class="input" type="checkbox" name="lana" value="value">I also want to tweet my grades to Lana Del Rey.</input> --> |
| gpa.get_term_gpa())) .newline() .add( | ||
| "Your cumulative GPA is: {0}".format( | ||
| gpa.get_cumulative_gpa())) .newline() | ||
| if omitgrade == "False" or omitgrade != "True": |
There was a problem hiding this comment.
Not a fan of omitgrade being a string acting as a boolean. Let's make it a boolean outright.
| else None | ||
| if changelog is not None: | ||
| message = create_text_message(changelog) | ||
| message = create_text_message(changelog, user.get_omitgrade()) |
There was a problem hiding this comment.
maybe the method name could be: user.requestedGradeOmission.
Reads better I feel.
|
|
||
| class User(): | ||
| def __init__(self, username, password, number, school_code = None): | ||
| def __init__(self, username, password, number, school_code = None, omitgrade = False): |
There was a problem hiding this comment.
This makes sense, here omitgrade is a boolean
| def set_school_code(self, school_code): | ||
| self._school_code = school_code | ||
|
|
||
| def set_omitgrade(self, omitgrade): |
There was a problem hiding this comment.
method name suggestion: requestedGradeOmission
|
Disregard Danger/CunyBot making a fuss, I still haven't fixed it. |
Changed the code in a way that I think should add the omit grade option and its functionality. Not sure what is the best way to test it locally tho. Let me know what you guys think.