Son prototip tamamlandı

This commit is contained in:
Yasin İLKAYA 2025-12-22 22:46:00 +03:00
parent 639383b008
commit e059f22ed0
4 changed files with 60 additions and 7 deletions

View File

@ -195,16 +195,39 @@ async function getStudentScores(owner_id, start, length, searchTerm)
.whereRaw('?? = ??', ['student_events.student_id', 'students.id']) .whereRaw('?? = ??', ['student_events.student_id', 'students.id'])
.where('owner_id', owner_id) .where('owner_id', owner_id)
.whereNull('deleted_at') .whereNull('deleted_at')
.as('total_score') .as('total_score'),
DB('student_events')
.sum('score')
.whereRaw('?? = ??', ['student_events.student_id', 'students.id'])
.where('owner_id', owner_id)
.where('score',"<","0")
.whereNull('deleted_at')
.as('negative_score'),
DB('student_events')
.sum('score')
.whereRaw('?? = ??', ['student_events.student_id', 'students.id'])
.where('owner_id', owner_id)
.where('score',">","0")
.whereNull('deleted_at')
.as('positive_score')
]) ])
.where("name","like",`%${searchTerm ?? ""}%`) .where("name","like",`%${searchTerm ?? ""}%`)
.whereNull('deleted_at') .whereNull('students.deleted_at')
.where('owner_id', owner_id)
.orderBy('total_score', 'desc') .orderBy('total_score', 'desc')
.limit(length) .limit(length)
.offset(start); .offset(start);
return students; return students.map(e => {
e.total_score = e.total_score == null ? 0 : e.total_score;
return e;
});
} }
/*
negative_score
positive_score
*/
async function deleteEvent(owner_id, id) async function deleteEvent(owner_id, id)
{ {
await DB.table("student_events") await DB.table("student_events")

View File

@ -79,10 +79,29 @@
return `${data.name} ${data.surname || ''}`; return `${data.name} ${data.surname || ''}`;
} }
}, },
{
title: "Negatif Puan",
data: "negative_score",
name: "negative_score",
render:e => {
return `<span class="text-danger">${e.toString()}</span>`;
}
},
{
title: "Pozitif Puan",
data: "positive_score",
name: "positive_score",
render:e => {
return `<span class="text-success">+${e.toString()}</span>`;
}
},
{ {
title: "Toplam Puanı", title: "Toplam Puanı",
data: "total_score", data: "total_score",
name: "total_score" name: "total_score",
render:e => {
return `<span class="text-primary">+${e.toString()}</span>`;
}
} }
], ],
"language": { "language": {

View File

@ -1,8 +1,19 @@
</div> <div class="go-top">
<div class="go-top">
<span class="progress-value"> <span class="progress-value">
<i class="ti ti-arrow-up"></i> <i class="ti ti-arrow-up"></i>
</span> </span>
</div>
<footer>
<div class="container-fluid">
<div class="row">
<div class="col-md-9 col-12">
<p class="footer-text f-w-600 mb-0">
Tasarım ve uygulama <u><a target="_blank" class="text-primary" href="https://tr.linkedin.com/in/abdussamed-ulutas">Abdussamed ULUTAŞ</a></u> ⚡ tarafından yapılmıştır
</p>
</div>
</div>
</div>
</footer>
</div> </div>
<div id="customizer"></div> <div id="customizer"></div>
<script src="/assets/vendor/datatable/jquery.dataTables.min.js"></script> <script src="/assets/vendor/datatable/jquery.dataTables.min.js"></script>

View File

@ -3,7 +3,7 @@
<a class="d-inline-block py-2 px-3" class="text-success" href="/"> <a class="d-inline-block py-2 px-3" class="text-success" href="/">
<img alt="#" src="/logo.png" style="max-height: 50px;vertical-align: middle"> <img alt="#" src="/logo.png" style="max-height: 50px;vertical-align: middle">
<span style="font-size: 2em; vertical-align: middle; letter-spacing: 3px;"> <span style="font-size: 2em; vertical-align: middle; letter-spacing: 3px;">
YeşilSkor EkoEtki
</span> </span>
</a> </a>