-
Notifications
You must be signed in to change notification settings - Fork 25
Data service #94
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
Data service #94
Conversation
|
This pull request introduces 1 alert and fixes 1 when merging 843e465 into 96f579a - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 1 alert and fixes 1 when merging 8b44aa0 into 96f579a - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 2 alerts and fixes 1 when merging fca5eaf into 96f579a - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 2 alerts and fixes 1 when merging e428403 into 96f579a - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 3 alerts and fixes 1 when merging 8fd563c into 96f579a - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 3 alerts and fixes 1 when merging 4363cb5 into 3f51487 - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 2 alerts and fixes 1 when merging ddb58ab into 3f51487 - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 1 alert and fixes 1 when merging e7c3746 into 3f51487 - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request introduces 1 alert and fixes 1 when merging 79e0108 into 3f51487 - view on LGTM.com new alerts:
fixed alerts:
|
|
This pull request fixes 1 alert when merging 3cc0aec into 3f51487 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 1 alert when merging fee2c8a into 3f51487 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 1 alert when merging a05d7ff into c9cc5a0 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 1 alert when merging 337d689 into c9cc5a0 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 1 alert when merging 8fbcdc2 into 85e996e - view on LGTM.com fixed alerts:
|
|
This pull request fixes 1 alert when merging b725a75 into 85e996e - view on LGTM.com fixed alerts:
|
python/__main__.py
Outdated
| def get_github_profile_string(self, user): | ||
| profile = self.data.get_user_property(user, "github_profile") | ||
| return f"github.com/{profile}" if profile else "отсутствует" | ||
|
|
||
| def get_github_profile_top_string(self, user): | ||
| profile = self.get_github_profile(user) | ||
| if profile: | ||
| profile = f" — github.com/{profile}" | ||
| return profile | ||
| profile = self.data.get_user_property(user, "github_profile") | ||
| return f" — github.com/{profile}" if profile else "" |
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.
| def get_github_profile_string(self, user): | |
| profile = self.data.get_user_property(user, "github_profile") | |
| return f"github.com/{profile}" if profile else "отсутствует" | |
| def get_github_profile_top_string(self, user): | |
| profile = self.get_github_profile(user) | |
| if profile: | |
| profile = f" — github.com/{profile}" | |
| return profile | |
| profile = self.data.get_user_property(user, "github_profile") | |
| return f" — github.com/{profile}" if profile else "" | |
| def get_github_profile_or_default(self, user, default="", prefix=""): | |
| profile = self.data.get_user_property(user, "github_profile") | |
| return f"{prefix}github.com/{profile}" if profile else default |
python/__main__.py
Outdated
| self.data.set_user_property(user, "karma", self.data.get_user_property(user, "karma") + amount) | ||
| initial_karma = self.data.get_user_property(user, "karma"), | ||
| self.data.set_user_property(user, "karma", initial_karma + amount) | ||
| return (user.uid, | ||
| self.data.get_user_property(user, "name"), | ||
| initial_karma, | ||
| self.data.get_user_property(user, "karma")) |
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.
| self.data.set_user_property(user, "karma", self.data.get_user_property(user, "karma") + amount) | |
| initial_karma = self.data.get_user_property(user, "karma"), | |
| self.data.set_user_property(user, "karma", initial_karma + amount) | |
| return (user.uid, | |
| self.data.get_user_property(user, "name"), | |
| initial_karma, | |
| self.data.get_user_property(user, "karma")) | |
| initial_karma = self.data.get_user_property(user, "karma"), | |
| new_karma = initial_karma + amount; | |
| self.data.set_user_property(user, "karma", new_karma) | |
| return (user.uid, | |
| self.data.get_user_property(user, "name"), | |
| initial_karma, | |
| new_karma) |
python/DataService.py
Outdated
| def get_users_sorted_by_keys(self, other_keys, sort_key=None): | ||
| users = self.base.getByKeys(*other_keys) | ||
| sorted_users = sorted( | ||
| users, | ||
| key=sort_key, | ||
| reverse=True | ||
| ) | ||
| return sorted_users |
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.
| def get_users_sorted_by_keys(self, other_keys, sort_key=None): | |
| users = self.base.getByKeys(*other_keys) | |
| sorted_users = sorted( | |
| users, | |
| key=sort_key, | |
| reverse=True | |
| ) | |
| return sorted_users | |
| def get_users(self, other_keys, sort_key=None): | |
| users = self.base.getByKeys(*other_keys) | |
| if sort_key is not None: | |
| users = sorted( | |
| users, | |
| key=sort_key, | |
| reverse=True | |
| ) | |
| return users |
python/DataService.py
Outdated
| def get_user_sorted_programming_languages(self, user): | ||
| languages = self.get_user_property(user, "programming_languages") | ||
| languages = languages if type(languages) == list else [] | ||
| languages.sort() | ||
| return languages |
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.
| def get_user_sorted_programming_languages(self, user): | |
| languages = self.get_user_property(user, "programming_languages") | |
| languages = languages if type(languages) == list else [] | |
| languages.sort() | |
| return languages | |
| def get_user_programming_languages(self, user, sort=True): | |
| languages = self.get_user_property(user, "programming_languages") | |
| languages = languages if type(languages) == list else [] | |
| if sort: | |
| languages.sort() | |
| return languages |
|
This pull request fixes 1 alert when merging 6552f9b into c021e09 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 1 alert when merging b676737 into c021e09 - view on LGTM.com fixed alerts:
|
|
This pull request fixes 1 alert when merging a662989 into c021e09 - view on LGTM.com fixed alerts:
|
Added a DataService file containing the BetterBotBaseDataService class