Skip to content

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

Conversation

maxceem
Copy link
Contributor

@maxceem maxceem commented Sep 17, 2018

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.


-- Add new columns
ALTER TABLE projects ADD COLUMN "lastActivityAt" timestamp with time zone;
ALTER TABLE projects ADD COLUMN "lastActivityUserId" INT;

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

Copy link
Contributor Author

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?

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vikasrohit

I do have one edge case where a topic/post is updated by a user like coderbot

That's a very good catch.

@vikasrohit @RishiRajSahu

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:

image

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@RishiRajSahu RishiRajSahu left a comment

Choose a reason for hiding this comment

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

LGTM

@RishiRajSahu RishiRajSahu changed the base branch from dev to feature/project_activity September 19, 2018 10:16
@RishiRajSahu RishiRajSahu merged commit efd34d8 into topcoder-platform:feature/project_activity Sep 19, 2018
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