Example #1
0
 def __init__(self, rating: Rating):
     self.id = rating.id
     self.from_user = users.get_by_id(rating.from_id)
     self.to_user = users.get_by_id(rating.to_id)
     self.value = rating.value
     self.created_at = rating.created_at
     self.comment = rating.comment
Example #2
0
def timer_for_comment(chat_id: int, rating_id):
    scheduler.remove_timer_for_comment(rating_id)
    rating = ratings.get_rating_by_id(rating_id)
    user = users.get_by_id(rating.from_id)
    selected_user = users.get_by_id(rating.to_id)
    if not rating:
        return
    if rating.comment:
        return
    success_message = strings.get_string('estimates.success', user.language).format(name=selected_user.name,
                                                                                    department=selected_user.department.name)
    telegram_bot.clear_step_handler_by_chat_id(chat_id)
    Navigation.to_main_menu(user, chat_id, message_text=success_message)
    if rating.value < 4:
        Helpers.send_bad_rating_to_managers(rating, user, selected_user)
Example #3
0
 def post(self, request, *args, **kwargs):
     user = users.get_by_id(kwargs.get('pk'))
     if not user:
         raise Http404()
     self.object = user
     if not user.is_manager:
         self.company = user.department.company
     else:
         self.company = None
     return super().post(request, args, kwargs)
Example #4
0
 def __init__(self, rating: Dict):
     self.user = users.get_by_id(rating['to_id'])
     self.avg_value = rating['avg_value']
     self.count = rating['count']