Przeglądaj źródła

Ajustes resumen eventos

ElPoteito 2 lat temu
rodzic
commit
507af27aa5

+ 1 - 1
commands/UsuarioController.php

@@ -76,7 +76,7 @@ class UsuarioController extends Controller {
           }
           $modelo->genero = $data["genero"];
           $modelo->verificado = $data["verificado"];
-          $modelo->liderGobal = $data["liderGlobal"];
+          $modelo->liderGlobal = $data["liderGlobal"];
 
           if (!$modelo->save()) {
             $this->stdoutln('Ocurrió un error al guardar un usuario. ' . Json::encode($modelo->getFirstErrors()));

+ 1 - 2
config/web.php

@@ -60,8 +60,7 @@ $config = [
             'v1/usuario',
             'v1/reporte-individual',
             'v1/reporte-global',
-            'v1/evento-notificacion',
-            'v1/evento-resumen'
+            'v1/evento-notificacion'
           ],
         ]
       ],

+ 46 - 46
models/EventoResumenDependencia.php

@@ -15,54 +15,54 @@ use Yii;
  * @property EventoResumen $EventoResumen
  */
 class EventoResumenDependencia extends \yii\db\ActiveRecord {
-    /**
-     * {@inheritdoc}
-     */
-    public static function tableName() {
-        return 'EventoResumenDependencia';
-    }
+  /**
+   * {@inheritdoc}
+   */
+  public static function tableName() {
+    return 'EventoResumenDependencia';
+  }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function rules() {
-        return [
-            [['idEventoResumen', 'idDependencia'], 'required'],
-            [['idEventoResumen', 'idDependencia'], 'default', 'value' => null],
-            [['idEventoResumen', 'idDependencia'], 'integer'],
-            [['clave'], 'string', 'max' => 50],
-            [['idEventoResumen', 'idDependencia'], 'unique', 'targetAttribute' => ['idEventoResumen', 'idDependencia']],
-            [['idDependencia'], 'exist', 'skipOnError' => true, 'targetClass' => Dependencia::class, 'targetAttribute' => ['idDependencia' => 'id']],
-            [['idEventoResumen'], 'exist', 'skipOnError' => true, 'targetClass' => EventoResumen::class, 'targetAttribute' => ['idEventoResumen' => 'id']],
-        ];
-    }
+  /**
+   * {@inheritdoc}
+   */
+  public function rules() {
+    return [
+      [['idEventoResumen', 'idDependencia'], 'required'],
+      [['idEventoResumen', 'idDependencia'], 'default', 'value' => null],
+      [['idEventoResumen', 'idDependencia'], 'integer'],
+      [['clave'], 'string', 'max' => 50],
+      [['idEventoResumen', 'idDependencia'], 'unique', 'targetAttribute' => ['idEventoResumen', 'idDependencia']],
+      [['idDependencia'], 'exist', 'skipOnError' => true, 'targetClass' => Dependencia::class, 'targetAttribute' => ['idDependencia' => 'id']],
+      [['idEventoResumen'], 'exist', 'skipOnError' => true, 'targetClass' => EventoResumen::class, 'targetAttribute' => ['idEventoResumen' => 'id']],
+    ];
+  }
 
-    /**
-     * {@inheritdoc}
-     */
-    public function attributeLabels() {
-        return [
-            'idEventoResumen' => 'Id Evento Resumen',
-            'idDependencia' => 'Id Dependencia',
-            'clave' => 'Clave',
-        ];
-    }
+  /**
+   * {@inheritdoc}
+   */
+  public function attributeLabels() {
+    return [
+      'idEventoResumen' => 'Id Evento Resumen',
+      'idDependencia' => 'Id Dependencia',
+      'clave' => 'Clave',
+    ];
+  }
 
-    /**
-     * Gets query for [[IdDependencia0]].
-     *
-     * @return \yii\db\ActiveQuery
-     */
-    public function getDependencia() {
-        return $this->hasOne(Dependencia::class, ['id' => 'idDependencia']);
-    }
+  /**
+   * Gets query for [[IdDependencia0]].
+   *
+   * @return \yii\db\ActiveQuery
+   */
+  public function getDependencia() {
+    return $this->hasOne(Dependencia::class, ['id' => 'idDependencia']);
+  }
 
-    /**
-     * Gets query for [[IdEventoResumen0]].
-     *
-     * @return \yii\db\ActiveQuery
-     */
-    public function getEventoResumen() {
-        return $this->hasOne(EventoResumen::class, ['id' => 'idEventoResumen']);
-    }
+  /**
+   * Gets query for [[IdEventoResumen0]].
+   *
+   * @return \yii\db\ActiveQuery
+   */
+  public function getEventoResumen() {
+    return $this->hasOne(EventoResumen::class, ['id' => 'idEventoResumen']);
+  }
 }

+ 11 - 10
modules/v1/controllers/EventoResumenController.php

@@ -14,45 +14,46 @@ class EventoResumenController extends JsonController {
   public $modelName = "EventoResumen";
 
   public function actionIndex() {
-    $id = trim($this->req->get("id", ""));
+    $clave = trim($this->req->get("id", ""));
 
 
-    $modelo = EventoResumenDependencia::find()
-      ->andWhere(['clave' => $id])
+    $modelo = EventoResumen::find()
+      ->andWhere(['uuid' => $clave])
       ->one();
 
     if ($modelo === null) {
       return (new Respuesta())
         ->esError()
-        ->mensaje("ID no válida");
+        ->mensaje("Clave no válida");
     }
 
     $query = $this->queryInicial
       ->andWhere([
-        'idEventoResumen' => $modelo->idEventoResumen,
-        'idDependencia' => $modelo->idDependencia
+        'idEventoResumen' => $modelo->id,
       ]);
 
     return new Respuesta($query, $this->limite, $this->pagina, $this->ordenar);
   }
 
   public function actionConsultaDependencia() {
-    $clave = trim($this->req->get("clave", ""));
 
+    $id = trim($this->req->get("id", ""));
 
-    $modelo = EventoResumen::find()
-      ->andWhere(['clave' => $clave])
+
+    $modelo = EventoResumenDependencia::find()
+      ->andWhere(['clave' => $id])
       ->one();
 
     if ($modelo === null) {
       return (new Respuesta())
         ->esError()
-        ->mensaje("Clave no válida");
+        ->mensaje("ID no válida");
     }
 
     $query = $this->queryInicial
       ->andWhere([
         'idEventoResumen' => $modelo->idEventoResumen,
+        'idDependencia' => $modelo->idDependencia
       ]);
 
     return new Respuesta($query, $this->limite, $this->pagina, $this->ordenar);