Skip to content

Commit dc729c8

Browse files
committed
examen ultimo cambio
1 parent 9a36912 commit dc729c8

File tree

6 files changed

+28
-5
lines changed

6 files changed

+28
-5
lines changed

backend/module/courses/controller/controller_courses.class.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ function puntuarCurso(){
3030
$verificaPuntos=loadModel(MODEL_COURSES, "courses_model", "verificaPuntos", $datos );
3131
if (count($verificaPuntos)==0) {
3232
$insertarPuntuacionComentario = loadModel(MODEL_COURSES, "courses_model", "insertarPuntuacion", $datos);
33-
$res["mensaje"]="Puntiacion exitosa";
33+
$res["mensaje"]="HECHO";
3434
}else{
35-
$res["mensaje"]="Ya as puntuado este";
35+
$updatePuntos = loadModel(MODEL_COURSES, "courses_model", "updatePuntos", $datos);
36+
$res["mensaje"]="PUNTOS ACTUALIZADOS";
3637
}
3738

3839
}else{

backend/module/courses/model/BLL/courses_bll.class.singleton.php

+3
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,7 @@ public function cursosPuntos_BLL($arrArgument){
6767
public function verificaPuntos_BLL($arrArgument){
6868
return $this->dao->verificaPuntos_DAO($this->db,$arrArgument);
6969
}
70+
public function updatePuntos_BLL($arrArgument){
71+
return $this->dao->updatePuntos_DAO($this->db,$arrArgument);
72+
}
7073
}

backend/module/courses/model/DAO/courses_dao.class.singleton.php

+11
Original file line numberDiff line numberDiff line change
@@ -170,5 +170,16 @@ public function verificaPuntos_DAO($db, $arrArgument) {
170170
// $sql = "SELECT COUNT(DISTINCT p.user) as cantidad, p.id_curso FROM puntuaciones as p GROUP BY p.id_curso";
171171
return $db->listar($db->ejecutar($sql));
172172
}
173+
public function updatePuntos_DAO($db, $arrArgument) {
174+
$curso=$arrArgument["id_curso"];
175+
$user=$arrArgument["user"];
176+
$puntos=$arrArgument["puntos"];
177+
178+
$sql = "UPDATE puntuaciones SET puntuacion='$puntos' WHERE id_curso='$curso' and user='$user'";
179+
return $db->ejecutar($sql);
180+
}
181+
/*UPDATE table_name
182+
SET column1=value, column2=value2,...
183+
WHERE some_column=some_value */
173184

174185
}//End productDAO

backend/module/courses/model/model/courses_model.class.singleton.php

+3
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,7 @@ public function create_course($arrArgument) {
6363
public Function verificaPuntos($arrArgument){
6464
return $this->bll->verificaPuntos_BLL($arrArgument);
6565
}
66+
public Function updatePuntos($arrArgument){
67+
return $this->bll->updatePuntos_BLL($arrArgument);
68+
}
6669
}

frontend/module/courses/controller/courses.controller.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@ appLibra.controller('coursesCategoryCtrl', ['$rootScope', '$scope', '$timeout',
1515
services.post('courses', 'puntuarCurso', info)
1616
.then(function (response) {
1717
console.log(response);
18-
CommonService.alert("info", response.mensaje, "PUNTUAR");
18+
if (response.success) {
19+
CommonService.alert("success", response.mensaje, "PUNTUAR");
20+
}else{
21+
CommonService.alert("error", response.mensaje, "PUNTUAR");
22+
}
1923
});
2024
}else{
21-
CommonService.alert("error", "error de identidad", "PUNTUAR");
25+
CommonService.alert("error", "error de identidad. Inicie sesion nuevamente y vuelva a intentar puntuar", "PUNTUAR");
2226
}
2327
}
2428

frontend/module/profile/view/view_panelControl/cursosPuntuados.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
<img src="backend/{{curso.avatar}}" style="height: 200px;">
1515
</a>
1616
</div>
17-
<a href="#/course/{{curso.id}}" class="pointer col-md-12 btn btn-info">Ver curso</a><br>
17+
<div>puntuacion: {{curso.puntuacion}}</div>
18+
<a href="#/course/{{curso.id}}" class="pointer col-md-12 btn btn-info">Vereeee curso</a><br>
1819
<br>
1920
<br>
2021
<br>

0 commit comments

Comments
 (0)