Skip to content

Commit

Permalink
Merge pull request cyclic-software#24 from royyan005/local
Browse files Browse the repository at this point in the history
add angka mutu final
  • Loading branch information
royyan005 authored Sep 30, 2022
2 parents ce35f83 + 2f35e8f commit 95037f7
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 2 deletions.
8 changes: 7 additions & 1 deletion controller/form.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,7 +812,13 @@ export const deleteMatkul = async (req, res) => {
})

const deleteipk = await Mahasiswa.update({
ipk: null
ipk: null,
am1: null,
am2: null,
am3: null,
am4: null,
am5: null,
am6: null,
}, {
where: {
id: req.params.idmahasiswa
Expand Down
27 changes: 26 additions & 1 deletion controller/mahasiswa.js
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,12 @@ export const updateIpkMahasiswa = async (req, res) => {
}

var ipk = 0.0
var am1 = 0.0
var am2 = 0.0
var am3 = 0.0
var am4 = 0.0
var am5 = 0.0
var am6 = 0.0

try {
const matkul1pembimbing1 = await Matkul1.findAll({
Expand Down Expand Up @@ -677,6 +683,19 @@ export const updateIpkMahasiswa = async (req, res) => {
})
if (!matkul6penguji) return err

const totalam1 = ((0.4 * matkul1pembimbing1[0].angkamutu) + (0.4 * matkul1pembimbing2[0].angkamutu) + (0.3 * matkul1penguji[0].angkamutu))
const totalam2 = ((0.4 * matkul2pembimbing1[0].angkamutu) + (0.4 * matkul2pembimbing2[0].angkamutu) + (0.3 * matkul2penguji[0].angkamutu))
const totalam3 = ((0.4 * matkul3pembimbing1[0].angkamutu) + (0.4 * matkul3pembimbing2[0].angkamutu) + (0.3 * matkul3penguji[0].angkamutu))
const totalam4 = ((0.4 * matkul4pembimbing1[0].angkamutu) + (0.4 * matkul4pembimbing2[0].angkamutu) + (0.3 * matkul4penguji[0].angkamutu))
const totalam5 = ((0.4 * matkul5pembimbing1[0].angkamutu) + (0.4 * matkul5pembimbing2[0].angkamutu) + (0.3 * matkul5penguji[0].angkamutu))
const totalam6 = ((0.4 * matkul6pembimbing1[0].angkamutu) + (0.4 * matkul6pembimbing2[0].angkamutu) + (0.3 * matkul6penguji[0].angkamutu))
am1 = totalam1/3
am2 = totalam2/3
am3 = totalam3/3
am4 = totalam4/3
am5 = totalam5/3
am6 = totalam6/3

const totalskspembimbing1 = matkul1pembimbing1[0].sks + matkul2pembimbing1[0].sks + matkul3pembimbing1[0].sks + matkul4pembimbing1[0].sks + matkul5pembimbing1[0].sks + matkul6pembimbing1[0].sks
const totalnilaimutupembimbing1 = matkul1pembimbing1[0].nilaimutu + matkul2pembimbing1[0].nilaimutu + matkul3pembimbing1[0].nilaimutu + matkul4pembimbing1[0].nilaimutu + matkul5pembimbing1[0].nilaimutu + matkul6pembimbing1[0].nilaimutu
const totalskspembimbing2 = matkul1pembimbing2[0].sks + matkul2pembimbing2[0].sks + matkul3pembimbing2[0].sks + matkul4pembimbing2[0].sks + matkul5pembimbing2[0].sks + matkul6pembimbing2[0].sks
Expand All @@ -694,7 +713,13 @@ export const updateIpkMahasiswa = async (req, res) => {

try {
const updateMahasiswa = await Mahasiswa.update({
ipk: ipk
ipk: ipk,
am1: am1,
am2: am2,
am3: am3,
am4: am4,
am5: am5,
am6: am6,
}, {
where: {
id: idmahasiswa
Expand Down
18 changes: 18 additions & 0 deletions models/mahasiswa.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,24 @@ const Mahasiswa = db.define('mahasiswas',{
},
ipk: {
type: Float32Array,
},
am1: {
type: Float32Array,
},
am2: {
type: Float32Array,
},
am3: {
type: Float32Array,
},
am4: {
type: Float32Array,
},
am5: {
type: Float32Array,
},
am6: {
type: Float32Array,
}
});

Expand Down

0 comments on commit 95037f7

Please sign in to comment.