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

Created UserManager #46

Merged
merged 13 commits into from
May 7, 2024
Merged

Created UserManager #46

merged 13 commits into from
May 7, 2024

Conversation

timofeev41
Copy link
Contributor

No description provided.

Copy link
Contributor Author

@timofeev41 timofeev41 left a comment

Choose a reason for hiding this comment

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

нормас



UnitWrapper = UnitWrapper()
BaseUnitWrapper = UnitWrapper()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

а был смысл его переименовывать? думаю нет

Copy link
Contributor

Choose a reason for hiding this comment

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

Такая штука была, что импортился класс UnitManager, а не его экземпляр. Поэтому переименовал

Comment on lines 36 to 37
self.collection = "unitData"
self.database = BaseMongoDbWrapper
Copy link
Contributor Author

Choose a reason for hiding this comment

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

лучше сделать как аттрибут класса

class UnitManager:
collection = "..."
wrapper = "..."

Comment on lines 64 to 65
@lru_cache(maxsize=4)
def _get_cur_unit(self) -> Unit:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

я уверен что эта штука мега жидко обосрется, если и делать кеш - то его надо как-то инвалидировать когда юнит снимается с воркбенча например, а тут этого нет

Copy link
Contributor Author

Choose a reason for hiding this comment

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

вообще можно поиграться и сделать просто current_unit как property, будет ярко

Copy link
Contributor

Choose a reason for hiding this comment

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

Кстати, я читал, что запросы в монгу по дефолту кешируются. Что скажешь по этому поводу?

Comment on lines 128 to 134
translation("Component")
+ " "
+ component.model_name
+ " "
+ translation("NotPartOfUnit")
+ " "
+ self.model_name
Copy link
Contributor Author

Choose a reason for hiding this comment

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

раз уж переделываем сделай тут через f-strings пожалуйста)))
хотя в этом случае хорошо будет смотреться .format()

Copy link
Contributor

@Berlimor Berlimor Apr 4, 2024

Choose a reason for hiding this comment

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

  • ок

)
metrics.register_complete_unit(None, self)

self.employee = None
Copy link
Contributor Author

Choose a reason for hiding this comment

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

почему-то в конце нигде нет пустых строк) а они должны быть в конце любого .py файла, гитхаб не просто так этот значок ставит

@PaTara43 PaTara43 merged commit 7eec218 into refactoring May 7, 2024
1 check failed
@Berlimor Berlimor deleted the ref/unit-mongo branch May 29, 2024 20:32
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.

3 participants