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

We auto create role #244

Draft
wants to merge 14 commits into
base: master
Choose a base branch
from
Draft

We auto create role #244

wants to merge 14 commits into from

Conversation

jplam123
Copy link

@jplam123 jplam123 commented Aug 6, 2021

Summary

Checklist

  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)

  • Have you tested the changes? (pytest & dpytest)
  • Have you followed PEP-8 for naming and styling?
  • Has your code been properly documented with RestructuredText docstrings?
  • Have you added your changes to CHANGELOG.md under the [Unreleased] heading?
  • If your code added new bot commands, have you updated documentation.json?

  • All of this code is your own, or follows the author repo's licence.

@codecov
Copy link

codecov bot commented Aug 6, 2021

Codecov Report

Merging #244 (87dfcf2) into master (29abb7b) will decrease coverage by 0.12%.
The diff coverage is 78.35%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #244      +/-   ##
==========================================
- Coverage   82.53%   82.41%   -0.13%     
==========================================
  Files          27       27              
  Lines        6534     6630      +96     
==========================================
+ Hits         5393     5464      +71     
- Misses       1141     1166      +25     
Flag Coverage Δ
unittests 82.41% <78.35%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cogs/Verification.py 65.34% <63.79%> (-0.37%) ⬇️
tests/test_Verification.py 100.00% <100.00%> (ø)
cogs/TwitchAlert.py 58.06% <0.00%> (-0.76%) ⬇️
cogs/Voting.py 61.91% <0.00%> (-0.08%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 29abb7b...87dfcf2. Read the comment docs.

@jplam123 jplam123 linked an issue Aug 6, 2021 that may be closed by this pull request
@lgtm-com
Copy link

lgtm-com bot commented Aug 6, 2021

This pull request introduces 2 alerts when merging cc977eb into 29abb7b - view on LGTM.com

new alerts:

  • 1 for Unused local variable
  • 1 for Redundant assignment

@lgtm-com
Copy link

lgtm-com bot commented Aug 6, 2021

This pull request introduces 1 alert when merging 19fbbe1 into 29abb7b - view on LGTM.com

new alerts:

  • 1 for Redundant assignment

@lgtm-com
Copy link

lgtm-com bot commented Aug 6, 2021

This pull request introduces 1 alert when merging 2a09754 into 29abb7b - view on LGTM.com

new alerts:

  • 1 for Redundant assignment

@lgtm-com
Copy link

lgtm-com bot commented Aug 6, 2021

This pull request introduces 1 alert when merging 6075450 into 29abb7b - view on LGTM.com

new alerts:

  • 1 for Redundant assignment

@lgtm-com
Copy link

lgtm-com bot commented Aug 6, 2021

This pull request introduces 1 alert when merging 4df82a6 into 29abb7b - view on LGTM.com

new alerts:

  • 1 for Redundant assignment

@jplam123 jplam123 marked this pull request as ready for review August 6, 2021 14:56
@lgtm-com
Copy link

lgtm-com bot commented Aug 6, 2021

This pull request introduces 1 alert when merging 87dfcf2 into 29abb7b - view on LGTM.com

new alerts:

  • 1 for Redundant assignment

@@ -44,6 +50,13 @@ def verify_is_enabled(ctx):

return result or (str(ctx.author) == KoalaBot.TEST_USER and KoalaBot.is_dpytest)


def check_if_role_exists(guild, university):
Copy link
Member

Choose a reason for hiding this comment

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

Please add a docstring above this, even though it's self explanitory it's still worth having one

self.DBManager.db_execute_commit(verified_table)
self.DBManager.db_execute_commit(non_verified_table)
self.DBManager.db_execute_commit(role_table)
self.DBManager.db_execute_commit(re_verify_table)
drop_universities = "DROP TABLE Universities"
Copy link
Member

Choose a reason for hiding this comment

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

Just wondering why you drop the table before re-creating it each time?

@@ -166,6 +191,9 @@ async def enable_verification(self, ctx, suffix=None, role=None):
:param role: the role to give users with that email verified (e.g. @students)
:return:
"""
role = role
if not suffix:
await ctx.send("hi")
Copy link
Member

Choose a reason for hiding this comment

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

Also just wondering the point in this considering the case of suffix not beign provided would be caught afterwards anyway

role_id = f"<@&{str(role.id)}>"
await self.verify_university(ctx, email_suffix, role_id, university)

def insert_university_csv(self):
Copy link
Member

Choose a reason for hiding this comment

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

Please include a test for this if possible

Copy link
Member

@Kaspiaan Kaspiaan left a comment

Choose a reason for hiding this comment

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

Please make sure all methods have tests where possible, also noticed some stuff I'm not sure the use behind such as dropping the table each time the init is called regardless of anythign else, also a random ctx.send("hi"), not sure if that was left over from debugging or I might be missing something.

@Kaspiaan
Copy link
Member

Kaspiaan commented Aug 8, 2021

To add onto the testing portion, have a look at the automated tests made on python 3.7 as some of the new tests failed. Another issue is the code coverage but this can be rectified by ensuring your tests cover as much as possible.

@Kaspiaan Kaspiaan assigned Kaspiaan and unassigned jplam123 and Jaddison011 Oct 18, 2021
@VirajShah18 VirajShah18 marked this pull request as draft November 9, 2021 00:39
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.

Auto Create University Roles
3 participants