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

Update get_quest_participants to return the timestamp of quest completion #358

Open
4 tasks
Marchand-Nicolas opened this issue Dec 22, 2024 · 25 comments · May be fixed by #359
Open
4 tasks

Update get_quest_participants to return the timestamp of quest completion #358

Marchand-Nicolas opened this issue Dec 22, 2024 · 25 comments · May be fixed by #359
Assignees
Labels
Good first issue Good for newcomers open for contribution An issue that is available for an Only Dust contribution

Comments

@Marchand-Nicolas
Copy link
Collaborator

Description 📹

Update src/endpoints/admin/quest/get_quest_participants.rs to return the timestamp of quest completion. The timestamp is the greatest timestamp among all completed_task documents for the specified quest & address.

Proposed Actions 🛠️

Here’s a checklist of actions to follow for resolving this issue:

  1. Fork and Create Branch:
    Fork the repository and create a new branch using the issue number:

    git checkout -b fix-[issue-number]
  2. Implement Changes:

    • Modify the get_quest_participants_handler function to include logic for fetching the greatest timestamp for each participant.
    • Update the aggregation pipeline in the handler to:
      • Fetch the maximum timestamp for each participant who has completed all tasks in the quest.
    • Update the response to include the timestamp alongside the participant details.
    • Add necessary error handling for timestamp extraction.

    TODO List:

    • Add $max stage in the aggregation pipeline to compute the maximum timestamp.
    • Include the computed timestamp in the response JSON.
    • Test the function to ensure it works with mock completed_task data.
    • Document the changes in the function comments.

    Example Code Snippet for Aggregation Update:

    let pipeline = vec![
        doc! { "$match": { "task_id": { "$in": &task_ids } } },
        doc! { "$group": {
            "_id": "$address",
            "task_ids": { "$addToSet": "$task_id" },
            "max_timestamp": { "$max": "$timestamp.$numberLong" }
        }},
        doc! { "$project": {
            "address": "$_id",
            "tasks_completed_count": { "$size": "$task_ids" },
            "quest_completion_timestamp": "$max_timestamp"
        }},
    ];
  3. Run Tests and Commit Changes:
    Make sure your changes don't break existing functionality and commit with a clear message:

    git commit -m "Fix: Include quest completion timestamp in get_quest_participants response"

Required 📋

To keep our workflow smooth, please make sure you follow these guidelines:

  • Assignment: Don't create a pull request if you weren’t assigned to this issue.
  • Timeframe: Complete the task within 3 business days.
  • Closing the Issue: In your PR description, close the issue by writing Close #[issue_id].
  • Review Process:
    • Once you've submitted your PR, change the label to "ready for review".
    • If changes are requested, address them and then update the label back to "ready for review" once done.
  • Testing: Test your PR locally before pushing, and verify that tests and build are working after pushing.

Thank you for your contribution 🙏

⚠️ WARNING: Failure to follow the requirements above may result in being added to the OnlyDust blacklist, affecting your ability to receive future rewards.

@Marchand-Nicolas Marchand-Nicolas added Good first issue Good for newcomers open for contribution An issue that is available for an Only Dust contribution labels Dec 22, 2024
@tasneemtoolba
Copy link

can I work on this issue?

@TropicalDog17
Copy link

Can I work on this issue? @Marchand-Nicolas

@emarc99
Copy link

emarc99 commented Dec 22, 2024

I would love to do this, sir!

@Birdmannn
Copy link

Can I handle this?

@jaykayudo
Copy link

jaykayudo commented Dec 22, 2024

Can i work on this?

How i will tackle this?

  • I will fork the branch in the proposed format fix-[issue-number]
  • I will modify the get_quest_participants_handler in the src/endpoints/admin/quest/get_quest_participants.rs file.
  • I will update the aggregation pipeline in the handler to fetch the maximum timestamp for each participant who has completed all tasks in the quest.
  • I will update the response to include the timestamp alongside the participant details.
  • I will follow the proposed code snippet to update the code and i will commit with the proposed commit message.
  • ETA - 12 hours

@NowGoody
Copy link

@Marchand-Nicolas can i make this my first contribution to the starkquest ecosystem, would be a nice one to have

@Luluameh
Copy link

I'd like to take this issue.
ETA: 1day

@OWK50GA
Copy link

OWK50GA commented Dec 22, 2024

Hi, @Marchand-Nicolas
Let me work on this

@Agbeleshe
Copy link

Can I be assign to this , I will love to make this my first contribution to Starknet project
ETA:20hr

@Benjtalkshow
Copy link
Contributor

@Marchand-Nicolas
Let me work on this task

@Snehagupta1907
Copy link

May I take this issue on?

@0xdevcollins
Copy link

Can I contribute to this one?

@olisaagbafor
Copy link

Would love to tackle this!

@Bashoroon
Copy link

Could I take over this issue?

@KevinLatino
Copy link

Hi @Marchand-Nicolas, can i take this issue?

I’ll modify the endpoint to return the latest completed_task timestamp for each quest

I am a full stack dev, trying to move forward, I'm a Dojo Coding member.

I am learning rust and i think this is a good first issue for me, it'll help me grow.

ETA = 12 hours

@No-bodyq
Copy link

Is this issue still available?

@0xRadioAc7iv
Copy link

Hi @Marchand-Nicolas,

I'm interested in working on this issue and would like to contribute to the project. Could you please assign it to me?

Thank you! 😊

@DanielEmmanuel1
Copy link

Let me try this one!
I'm a fullstack smart blockchain developer with ample expereience and i can complete this task.

@847850277
Copy link

Could I take a shot at this?

@3th-Enjay
Copy link

Can I handle this, I think have the experience to handle this

@aidenwong812
Copy link

Can I try solving this issue?

@mimisavage
Copy link
Contributor

Can I be assigned on this ?

@Marchand-Nicolas
Copy link
Collaborator Author

Hello @TropicalDog17 is everything okay ?

@TropicalDog17
Copy link

Hi, I will try to put up a draft PR today, sorry for the delay @Marchand-Nicolas

@Marchand-Nicolas
Copy link
Collaborator Author

Hi, I will try to put up a draft PR today, sorry for the delay @Marchand-Nicolas

No problem, just wanted to make sure everything was good

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Good first issue Good for newcomers open for contribution An issue that is available for an Only Dust contribution
Projects
None yet