-
Notifications
You must be signed in to change notification settings - Fork 56
Feature/project activity #180
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
Feature/project activity #180
Conversation
…so they are not accidentally committed
|
||
-- Add new columns | ||
ALTER TABLE projects ADD COLUMN "lastActivityAt" timestamp with time zone; | ||
ALTER TABLE projects ADD COLUMN "lastActivityUserId" INT; |
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.
@maxceem @RishiRajSahu we need to use string here because we are mostly using string in project models to capture the user as we might have situations where we have to store non number values like coderbot
or system
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.
@vikasrohit oh, it's one of the questions I was interested to clarify. As inside project service, for user ids we use two types INTEGER
and BIGINT
. So probably we have to agree which one is better to use for the future. For example here inside project model we use two types for user ids https://github.com/topcoder-platform/tc-project-service/blob/dev/src/models/project.js#L41-L42
I cannot find any place where we use string for user ids though, could you please point to any place for reference?
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.
I think I was confused with message api where we used to have non numerical user ids because of discourse and we have to keep that during migration to allow system/coderbot posts.
I guess in project service we can keep BIGINT to be consistent. However, I do have one edge case where a topic/post is updated by a user like coderbot
(it happens whenever coderbot posts a message e.g. on project creation it publishes a welcome message) or system
(this is most probably not going to happen now because we are away from discourse now), what we would put in lastActivityUserId
field in project service?
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.
I do have one edge case where a topic/post is updated by a user like coderbot
That's a very good catch.
Are we interested to update activity on the project which is done by a bot? The simple solution would be to check if initiatorUserId
is a number or check if it's an existent user and only, in that case, to update activity. But it's only if we are not interested in activity by bots.
Otherwise I guess, we have to make lastActivityUserId
as a string. So probably after we will show in the project list that latest activity in the project has been done by Coder Bot
:
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.
I think right now we are not willing to update the lastActivityAt
field for bot activity, however, I can not deny its future applicability. We might have a bot or autopilot sitting which can update project's phases during their life cycle e.g. autopilot closing a milestone automatically and activating next one.
So, I think we need to keep this as string for now.
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.
@vikasrohit Added commit: use string for lastActivityUserId
.
…1 (the beginning of Unix time)
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.
LGTM
…e places doesn't break any tests
Implementation for #176
It's based on the winning submission from the challenge https://www.topcoder.com/challenges/30070732
Some fixes/improvements have to be still made before merging.