Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

[$100] Flag to remove copilot payments #328

Closed
jmgasper opened this issue Jul 17, 2020 · 14 comments
Closed

[$100] Flag to remove copilot payments #328

jmgasper opened this issue Jul 17, 2020 · 14 comments

Comments

@jmgasper
Copy link
Collaborator

There are certain projects that are handled by TC admins that we shouldn't be creating copilot payments for when the tickets are closed. We'll still create the member payment for the winner of the challenge, but we won't create the copilot part of the payment.

To support this, let's create a checkbox next to the copilot field in the UI that says “Create Copilot Payments?” and if unchecked, it won’t. The user can then set an admin handle as the copilot and then uncheck the box and tasks will still get created and paid, but when the challenge is being paid, we won't add the additional $40 copilot payment to it.

@jmgasper jmgasper changed the title Flag to remove copilot payments [$100] Flag to remove copilot payments Jul 27, 2020
@jmgasper
Copy link
Collaborator Author

@afrisalyp - Would you like to take this one?

@jmgasper
Copy link
Collaborator Author

Contest https://www.topcoder.com/challenges/30134390 has been created for this ticket.

This is an automated message for ghostar via Topcoder X

@jmgasper
Copy link
Collaborator Author

Contest https://www.topcoder.com/challenges/30134390 has been updated - it has been assigned to afrisalyp.

This is an automated message for ghostar via Topcoder X

@afrisalyp
Copy link
Collaborator

@jmgasper

Sure. Will be delivered soon.

@jmgasper
Copy link
Collaborator Author

@afrisalyp - Sounds good, thanks!

@afrisalyp
Copy link
Collaborator

afrisalyp commented Jul 28, 2020

@jmgasper

What's the default state of the checkbox? Checked or unchecked?

And How's it affect the processor?
Do we need to add some attribute in the create challenge process?

@afrisalyp
Copy link
Collaborator

@jmgasper

I've just read the new issue #332
So the goal of this is to automatically process the copilot payment. Am I correct?
Do we have backend service ready for this feature or we need to implement it in our TCX app (Create a new challenge to make payment for copilot)?

@jmgasper
Copy link
Collaborator Author

@afrisalyp - The default state of the checkbox will be unchecked for new projects

This doesn't affect the Copilot Payments tab.

Instead, it affects the functionality in the processor where we automatically add copilot payments of $40 to each closed Github or Gitlab ticket. I don't think we set the $40 payment value itself, but we do add the copilot when the ticket is closed. Let's not do that if the checkbox is unchecked

From the processor / IssueService.js in handleIssueClose:


      const copilotAlreadySet = await topcoderApiHelper.roleAlreadySet(dbIssue.challengeId, 'Copilot');

      if (!copilotAlreadySet) {
        logger.debugWithContext(`Getting the topcoder member ID for copilot name : ${event.copilot.topcoderUsername}`, event, issue);
        // get copilot tc user id
        const copilotTopcoderUserId = await topcoderApiHelper.getTopcoderMemberId(event.copilot.topcoderUsername);

        // role id 14 for copilot
        const copilotResourceBody = {
          roleId: 14,
          resourceUserId: copilotTopcoderUserId,
          phaseId: 0,
          addNotification: true,
          addForumWatch: true
        };
        await topcoderApiHelper.addResourceToChallenge(dbIssue.challengeId, copilotResourceBody);
      } else {
        logger.debugWithContext('Copilot is already set, so skipping', event, issue);
      }

@afrisalyp
Copy link
Collaborator

@jmgasper

So as per my understanding, we won't set the copilot to the addResourceToChallenge method if the checkbox is unchecked. Is it correct?

@jmgasper
Copy link
Collaborator Author

@afrisalyp - Yes, that's correct

@afrisalyp
Copy link
Collaborator

@jmgasper

Any issues related to this ticket?
Let me know if any things need to be fixed.

@jmgasper
Copy link
Collaborator Author

jmgasper commented Aug 3, 2020

@afrisalyp - Nope, all good. Sorry for the delay.

@jmgasper
Copy link
Collaborator Author

jmgasper commented Aug 3, 2020

Payment task has been updated: https://software.topcoder.com/review/actions/ViewProjectDetails?pid=30134390

This is an automated message for ghostar via Topcoder X

@afrisalyp
Copy link
Collaborator

@jmgasper Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants