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

Feature/onboarding tasks #454

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open

Feature/onboarding tasks #454

wants to merge 14 commits into from

Conversation

maxwn04
Copy link
Contributor

@maxwn04 maxwn04 commented Oct 20, 2024

Info

Closes 453.

Description

Added a column for onboardingSeen and onboardingCollected in the Users table. Adjusted private profiles to return information for these onboarding tasks.

Changes

Type of Change

  • Patch (non-breaking change/bugfix)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to not work as
    expected)
  • Documentation (A change to a README/description)
  • Continuous Integration/DevOps Change (Related to deployment steps, continuous integration
    workflows, linting, etc.)
  • Other: (Fill In)

If you've selected Patch, Minor, or Major as your change type, make sure to bump the version before merging in package.json!

Testing

I have tested that my changes fully resolve the linked issue ...

  • locally.
  • [] on the testing API/testing database.
  • with appropriate Postman routes. Screenshots are included below.

Checklist

  • I have performed a self-review of my own code.
  • I have followed the style guidelines of this project.
  • I have appropriately edited the API version in the package.json file.
  • My changes produce no new warnings.

Screenshots

image
image

Copy link

Thanks for contributing!
If you've made changes to the API's functionality, please make sure to bump the package
version—see this guide to semantic versioning for details—and
document those changes as appropriate.

@maxwn04 maxwn04 requested a review from echang594 October 20, 2024 05:55
Copy link
Member

@nik-dange nik-dange left a comment

Choose a reason for hiding this comment

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

Left some initial comments and questions. I'm a little curious about future extensibility, e.g. if we have more reward-type features (basically acm passport), the way we're going right now demands having boolean flags on the user object. Thoughts on designing an alternative solution to handle this?

My main question is also how the onboarding reward is supposed to be "collected" since that was one of the main issues we were discussing back during acm passport ideation

migrations/0046-add-onboarding-task.ts Outdated Show resolved Hide resolved
services/UserAccountService.ts Outdated Show resolved Hide resolved
models/UserModel.ts Outdated Show resolved Hide resolved
@@ -269,7 +288,7 @@ export default class UserAccountService {
.activity(txn)
.logActivity(activity);

return updatedUser;
return updatedUser.getFullUserProfile();
Copy link
Member

Choose a reason for hiding this comment

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

what's the need to return full user profile here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

uh not sure why i did that

types/ApiRequests.ts Show resolved Hide resolved
}
if (userProfile.onboardingCollected) {
throw new BadRequestError('Onboarding reward already collected!');
}
Copy link
Member

Choose a reason for hiding this comment

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

Prior to returning, we should probably also log this in the activity table

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I just add the points bonus to activities or should I do the update to the user model as well?

Copy link
Member

Choose a reason for hiding this comment

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

Points bonus should just be fine–can you check if we log to activity any time there's a user object edit? I know we do it for user access updates but if there's more instances of it besides that then we can log the update to the user model

@maxwn04
Copy link
Contributor Author

maxwn04 commented Oct 23, 2024

I think the main reason I'm just hard-coding this achievement for now is because we wanted just to deliver this feature quicker while we have more discussions about actually how to actually design and implement an ACM passport system in the future. Especially since ACM passport still needs to be designed and there's still feedback and some other tasks to do on the backend side, I felt it's probably best just to do it this way first and redesign later.
As far as future extensibility, I think the idea of users pressing a button to claim achievement rewards is the simplest, and also delivers better on the ux side of things, since they get the satisfaction of claiming the reward and there might be a graphic/stickers to collect for these achievements which they could see get added when they collect achievements.

@nik-dange
Copy link
Member

Sure, I agree that having users "claim awards" or manually try to cash in is probably a good idea for now. In any case, updating that sort of thing in the future can be more easily swapped out.

If you really want this feature to be live by next week or something, then I suppose this change is fine. However, it does introduce significant tech debt–you'll now need some sort of script/migration to port over the data in this format to any new schema, then drop the column on the user table. Not ideal/good practice, you would need to have this run on every single user and generate x new rows in whatever future table holds this kind of data. Certainly not the end of the world computationally though.

My recommendation would be to design out the new feature (at least a V1 that can support multiple kinds of rewards), then introduce it at the start of winter quarter since fall has already started and it's unlikely that many new users are onboarding to the portal right now. I would really recommend not letting unclean practices pile up in the codebase and then deal with future problems later on, but we can discuss how you feel about it.

@maxwn04
Copy link
Contributor Author

maxwn04 commented Oct 28, 2024

Ok that is a good point I forgot about that. But on the other hand I was kind of thinking of these rewards as separate from a future achievement system. Especially since some of the checks here (i.e updating, bio, resume, pfp) probably wouldn't be part of a future achievement system that primarily tracks events attended/points spent. Ideally we would probably create a single achievement system that tracks all of it but I'm not really sure about what that would look like.

Also I kinda wanted to just get this feature pushed because it might be a while before we actually get to implementing an achievement system. There's still the feedback revamp to do and I was thinking we probably need to handle the updating packages stuff first since it seems like Typeorm has some big changes to figure out along with some eslint and aws changes.

Copy link
Member

@nik-dange nik-dange left a comment

Choose a reason for hiding this comment

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

In that case I'll leave it up to you, but it would be good to prioritize the design for this so that you can maybe look to implementing it in the next few months. If you want to move forward, feel free. I'll approve right now but check out my comment about the activity table and make sure to test this change in staging first. Also have the other backend devs take a look

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.

2 participants