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 system point : add more point & add reason #30

Closed
LevianthProject opened this issue Jan 17, 2022 · 1 comment · Fixed by #48
Closed

update system point : add more point & add reason #30

LevianthProject opened this issue Jan 17, 2022 · 1 comment · Fixed by #48
Labels
enhancement New feature or request

Comments

@LevianthProject
Copy link
Contributor

feature update

Point system count point more than 100 point

add feature

Add reason when ;addpoint & ;decpoint
example:
;addpoint @/users 1 {reason} events & ;decpoint @/users 1 {reason} bad attitude

@LevianthProject LevianthProject added the enhancement New feature or request label Jan 17, 2022
@dhafitf
Copy link
Member

dhafitf commented Jan 17, 2022

Point bisa lebih dari 100.
Namun jika menambah/mengurangi point pada user yang belum terdaftar pada database, maka akan dilakukan pembuatan data terlebih dahulu.

const points = await prisma.point.upsert({
where: {
ketua_id: members.user.id,
},
update: {
ketua_point: { increment: pointValue },
author_name: msg.author.username,
author_id: msg.author.id,
},
create: {
ketua_id: members.user.id,
ketua_name: members.user.username,
ketua_point: 1,
author_name: msg.author.username,
author_id: msg.author.id,
},
});

Kode di atas diartikan sebagai: "Temukan data ketua menggunakan id milik ketua, jika ditemukan pada database, maka update data yang ada. Namun jika tidak ditemukan, maka buat baru dengan default point 1".

Masalah ini mungkin bisa diatasi dengan mengganti default point pada kode.

Namun untuk menambah reason, mungkin perlu didiskusikan terlebih dahulu, karena juga mempertimbangkan issues #24

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants