Skip to content

Commit

Permalink
Merge pull request cyclic-software#8 from royyan005/local
Browse files Browse the repository at this point in the history
add huruf mutu field
  • Loading branch information
royyan005 authored Sep 11, 2022
2 parents 32c17b5 + 60607a2 commit 020dbee
Show file tree
Hide file tree
Showing 9 changed files with 432 additions and 276 deletions.
138 changes: 138 additions & 0 deletions controller/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,28 @@ export const postMatkul1 = async (req, res) => {

const total = sub1 + sub2 + sub3 + sub4
const average = total / 4
var hurufmutu = ''

if (average <= 100 && average >= 81) {
hurufmutu = 'A'
} else if (average <= 80 && average >= 75) {
hurufmutu = 'B+'
} else if (average <= 74 && average >= 70) {
hurufmutu = 'B'
} else if (average <= 69 && average >= 65) {
hurufmutu = 'C+'
} else if (average <= 64 && average >= 55) {
hurufmutu = 'C'
} else if (average <= 54 && average >= 50) {
hurufmutu = 'D'
} else if (average <= 49 && average >= 0) {
hurufmutu = 'E'
} else {
return res.status(400).json({
status: res.statusCode,
message: 'Nilai Tidak Valid'
})
}

var idmahasiswa = req.params.idmahasiswa
const mahasiswaExist = await Mahasiswa.findOne({
Expand All @@ -50,6 +72,7 @@ export const postMatkul1 = async (req, res) => {
sub4: sub4,
total: total,
average: average,
hurufmutu: hurufmutu,
iduser: iduser,
idmahasiswa: idmahasiswa,
});
Expand Down Expand Up @@ -88,6 +111,28 @@ export const postMatkul2 = async (req, res) => {

const total = sub1 + sub2 + sub3
const average = total / 3
var hurufmutu = ''

if (average <= 100 && average >= 81) {
hurufmutu = 'A'
} else if (average <= 80 && average >= 75) {
hurufmutu = 'B+'
} else if (average <= 74 && average >= 70) {
hurufmutu = 'B'
} else if (average <= 69 && average >= 65) {
hurufmutu = 'C+'
} else if (average <= 64 && average >= 55) {
hurufmutu = 'C'
} else if (average <= 54 && average >= 50) {
hurufmutu = 'D'
} else if (average <= 49 && average >= 0) {
hurufmutu = 'E'
} else {
return res.status(400).json({
status: res.statusCode,
message: 'Nilai Tidak Valid'
})
}

var idmahasiswa = req.params.idmahasiswa
const mahasiswaExist = await Mahasiswa.findOne({
Expand All @@ -110,6 +155,7 @@ export const postMatkul2 = async (req, res) => {
sub3: sub3,
total: total,
average: average,
hurufmutu: hurufmutu,
iduser: iduser,
idmahasiswa: idmahasiswa,
});
Expand Down Expand Up @@ -151,6 +197,28 @@ export const postMatkul3 = async (req, res) => {
const sub2 = (sub21 + sub22 + sub23 + sub24) / 4
const total = sub1 + sub2
const average = total / 2
var hurufmutu = ''

if (average <= 100 && average >= 81) {
hurufmutu = 'A'
} else if (average <= 80 && average >= 75) {
hurufmutu = 'B+'
} else if (average <= 74 && average >= 70) {
hurufmutu = 'B'
} else if (average <= 69 && average >= 65) {
hurufmutu = 'C+'
} else if (average <= 64 && average >= 55) {
hurufmutu = 'C'
} else if (average <= 54 && average >= 50) {
hurufmutu = 'D'
} else if (average <= 49 && average >= 0) {
hurufmutu = 'E'
} else {
return res.status(400).json({
status: res.statusCode,
message: 'Nilai Tidak Valid'
})
}

var idmahasiswa = req.params.idmahasiswa
const mahasiswaExist = await Mahasiswa.findOne({
Expand All @@ -176,6 +244,7 @@ export const postMatkul3 = async (req, res) => {
sub24: sub24,
total: total,
average: average,
hurufmutu: hurufmutu,
iduser: iduser,
idmahasiswa: idmahasiswa,
});
Expand Down Expand Up @@ -216,6 +285,28 @@ export const postMatkul4 = async (req, res) => {
const sub1 = (sub11 + sub12 + sub13 + sub14) / 4
const total = sub1
const average = total
var hurufmutu = ''

if (average <= 100 && average >= 81) {
hurufmutu = 'A'
} else if (average <= 80 && average >= 75) {
hurufmutu = 'B+'
} else if (average <= 74 && average >= 70) {
hurufmutu = 'B'
} else if (average <= 69 && average >= 65) {
hurufmutu = 'C+'
} else if (average <= 64 && average >= 55) {
hurufmutu = 'C'
} else if (average <= 54 && average >= 50) {
hurufmutu = 'D'
} else if (average <= 49 && average >= 0) {
hurufmutu = 'E'
} else {
return res.status(400).json({
status: res.statusCode,
message: 'Nilai Tidak Valid'
})
}

var idmahasiswa = req.params.idmahasiswa
const mahasiswaExist = await Mahasiswa.findOne({
Expand All @@ -240,6 +331,7 @@ export const postMatkul4 = async (req, res) => {
sub14: sub14,
total: total,
average: average,
hurufmutu: hurufmutu,
iduser: iduser,
idmahasiswa: idmahasiswa,
});
Expand Down Expand Up @@ -278,6 +370,28 @@ export const postMatkul5 = async (req, res) => {

const total = sub1 + sub2 + sub3
const average = total / 3
var hurufmutu = ''

if (average <= 100 && average >= 81) {
hurufmutu = 'A'
} else if (average <= 80 && average >= 75) {
hurufmutu = 'B+'
} else if (average <= 74 && average >= 70) {
hurufmutu = 'B'
} else if (average <= 69 && average >= 65) {
hurufmutu = 'C+'
} else if (average <= 64 && average >= 55) {
hurufmutu = 'C'
} else if (average <= 54 && average >= 50) {
hurufmutu = 'D'
} else if (average <= 49 && average >= 0) {
hurufmutu = 'E'
} else {
return res.status(400).json({
status: res.statusCode,
message: 'Nilai Tidak Valid'
})
}

var idmahasiswa = req.params.idmahasiswa
const mahasiswaExist = await Mahasiswa.findOne({
Expand All @@ -300,6 +414,7 @@ export const postMatkul5 = async (req, res) => {
sub3: sub3,
total: total,
average: average,
hurufmutu: hurufmutu,
iduser: iduser,
idmahasiswa: idmahasiswa,
});
Expand Down Expand Up @@ -336,6 +451,28 @@ export const postMatkul6 = async (req, res) => {

const total = sub1
const average = total
var hurufmutu = ''

if (average <= 100 && average >= 81) {
hurufmutu = 'A'
} else if (average <= 80 && average >= 75) {
hurufmutu = 'B+'
} else if (average <= 74 && average >= 70) {
hurufmutu = 'B'
} else if (average <= 69 && average >= 65) {
hurufmutu = 'C+'
} else if (average <= 64 && average >= 55) {
hurufmutu = 'C'
} else if (average <= 54 && average >= 50) {
hurufmutu = 'D'
} else if (average <= 49 && average >= 0) {
hurufmutu = 'E'
} else {
return res.status(400).json({
status: res.statusCode,
message: 'Nilai Tidak Valid'
})
}

var idmahasiswa = req.params.idmahasiswa
const mahasiswaExist = await Mahasiswa.findOne({
Expand All @@ -356,6 +493,7 @@ export const postMatkul6 = async (req, res) => {
sub1: sub1,
total: total,
average: average,
hurufmutu: hurufmutu,
iduser: iduser,
idmahasiswa: idmahasiswa,
});
Expand Down
3 changes: 3 additions & 0 deletions models/matkul1.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ const Matkul1 = db.define('matkul1',{
average: {
type: Float32Array,
},
hurufmutu: {
type: String,
},
idmahasiswa: {
type: Int16Array,
},
Expand Down
3 changes: 3 additions & 0 deletions models/matkul2.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const Matkul2 = db.define('matkul2',{
average: {
type: Float32Array,
},
hurufmutu: {
type: String,
},
idmahasiswa: {
type: Int16Array,
},
Expand Down
3 changes: 3 additions & 0 deletions models/matkul3.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ const Matkul3 = db.define('matkul3',{
average: {
type: Float32Array,
},
hurufmutu: {
type: String,
},
idmahasiswa: {
type: Int16Array,
},
Expand Down
3 changes: 3 additions & 0 deletions models/matkul4.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const Matkul4 = db.define('matkul4',{
average: {
type: Float32Array,
},
hurufmutu: {
type: String,
},
idmahasiswa: {
type: Int16Array,
},
Expand Down
3 changes: 3 additions & 0 deletions models/matkul5.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const Matkul5 = db.define('matkul5',{
average: {
type: Float32Array,
},
hurufmutu: {
type: String,
},
idmahasiswa: {
type: Int16Array,
},
Expand Down
3 changes: 3 additions & 0 deletions models/matkul6.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ const Matkul6 = db.define('matkul6',{
average: {
type: Float32Array,
},
hurufmutu: {
type: String,
},
idmahasiswa: {
type: Int16Array,
},
Expand Down
Loading

0 comments on commit 020dbee

Please sign in to comment.