Skip to content

Commit

Permalink
Merge pull request #189 from KU-niverse/revert-188-fix/error
Browse files Browse the repository at this point in the history
Revert "fix: 문자열 비교 에러 수정"
  • Loading branch information
youngsupchoi authored Nov 11, 2024
2 parents 3b4f3fe + db80bb3 commit 9b8f79f
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions controllers/wikiController.js
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ exports.comparisonGetMid = async (req, res) => {
return;
}

if (parseInt(oldrev) >= parseInt(rev)) {
if (oldrev >= rev) {
res.status(432).send({
success: false,
message: "oldrev should be smaller than rev",
Expand Down Expand Up @@ -918,13 +918,10 @@ exports.userContributionGetMid = async (req, res) => {
const rows2 = await Wiki.Wiki_point.getDocsContributions(req.user[0].id);

// 모든 doc_point의 합을 계산
const totalDocPoints = rows2.reduce(
(acc, doc) => acc + parseFloat(doc.doc_point),
0
);
const totalDocPoints = rows2.reduce((acc, doc) => acc + parseFloat(doc.doc_point), 0);

// 각 문서에 대해 percentage 계산하여 추가
rows2.forEach((doc) => {
rows2.forEach(doc => {
doc.percentage = (parseFloat(doc.doc_point) / totalDocPoints).toFixed(4); // 소수점 두 자리로 제한
});

Expand Down

0 comments on commit 9b8f79f

Please sign in to comment.