Skip to content
Snippets Groups Projects
Commit 97e38c73 authored by josborg's avatar josborg
Browse files

nombre en el ranking

parent 68fde39d
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 10 deletions
......@@ -2,16 +2,16 @@
<div class="row mt-5">
<h1>Opciones de adminstrador</h1>
<div class="col">
<div class="row mt-5">
<label for="">Añadir Bot a un servidor de discord: </label>
<div class="row">
<label for="">Añadir Bot a un servidor de discord: </label><br>
<div>
<button class="btn btn-primary ml-3" (click)="addBot()">Añadir</button>
</div>
</div>
</div>
<div class="col">
<label for="">Añadir redireccion al un servidor de discord: </label>
<button (click)="send()" >send()</button>
<label for="">Añadir redireccion al un servidor de discord: </label><br>
<button class="btn btn-primary ml-3" (click)="send()" >send()</button>
</div>
</div>
<div class="row">
......
......@@ -480,5 +480,5 @@
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<!-- * * * * * * * * * * End of Placeholder * * * * * * * * * * * -->
<!-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * -->
<app-nav></app-nav>
<router-outlet></router-outlet>
......@@ -23,6 +23,7 @@ import { NotLoggedGuard } from './not-logged.guard';
import { JwtInterceptor } from './jwt.interceptor';
import { AdminComponent } from './admin/admin.component';
import { NavComponent } from './nav/nav.component';
@NgModule({
......@@ -33,7 +34,8 @@ import { AdminComponent } from './admin/admin.component';
EncuestasEditarComponent,
EncuestasListarComponent,
AuthComponent,
AdminComponent
AdminComponent,
NavComponent
],
imports: [
BrowserModule,
......
......@@ -96,6 +96,7 @@ export class AuthComponent implements OnInit {
getIdByCode(){
this.code = ((localStorage.getItem('code') == null) ? "null" : localStorage.getItem('code'));
localStorage.setItem('userName', this.user.username+"#"+this.user.discriminator);
this.clienteApiRestEnc.getIdByCode(this.code).subscribe(
resp => {
//Gurdas jwt
......
......@@ -14,7 +14,9 @@
</fieldset>
<div class="col-sm-1"></div>
<fieldset class="form-group ms-5 ps-3 col-sm-5">
<p>deadline</p>
<p>estado de la encuesta</p>
<p>tipo de ranking</p>
</fieldset>
</div>
<div class="row p-4">
......
......@@ -12,7 +12,7 @@
<h1>Ranking</h1>
<div *ngFor="let solucion of soluciones; let i = index">
<div class="shadow-lg p-3 mb-1 bg-white rounded">
<p>{{solucion.id}} - {{solucion.diff / 1000}} segundos</p>
<p>{{solucion.user}} - {{solucion.diff / 1000}} segundos</p>
</div>
</div>
</div>
......
<div class="container">
<nav class="navbar navbar-expand-lg navbar-light bg-light px-5">
<a class="navbar-brand" href="#">Navbar</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" [routerLink]="['/client/admin']">Administracion</a>
</li>
<li class="nav-item">
<a class="nav-link" [routerLink]="['/client/auth']">Autenticar</a>
</li>
</ul>
</div>
</nav>
</div>
\ No newline at end of file
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { NavComponent } from './nav.component';
describe('NavComponent', () => {
let component: NavComponent;
let fixture: ComponentFixture<NavComponent>;
beforeEach(async () => {
await TestBed.configureTestingModule({
declarations: [ NavComponent ]
})
.compileComponents();
});
beforeEach(() => {
fixture = TestBed.createComponent(NavComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-nav',
templateUrl: './nav.component.html',
styleUrls: ['./nav.component.css']
})
export class NavComponent implements OnInit {
constructor() { }
ngOnInit(): void {
}
}
......@@ -33,6 +33,7 @@ export class PreguntasComponent implements OnInit {
newSolucion = {
id: 0,
user: "",
idEncuesta: 0,
respuestas: [],
inicio: 0,
......@@ -104,6 +105,12 @@ export class PreguntasComponent implements OnInit {
enviarSolucion(){
this.solucion.idEncuesta = this.id;
this.solucion.fin = new Date().getTime();
var user = localStorage.getItem('userName');
if (user == null){
this.solucion.user = "null";
}else{
this.solucion.user = user;
}
this.clienteApiRest.sendSolucion(this.solucion, this.id).subscribe(
resp =>{
if (resp.ok){
......
......@@ -6,5 +6,6 @@ export interface Solucion {
respuestas: Respuesta[]
inicio: Number,
fin: Number,
diff: number
diff: number,
user: string
}
......@@ -24,6 +24,7 @@ public class Solucion {
@Id
@GeneratedValue
private Integer id;
private String user;
private Integer idEncuesta;
@OneToMany(mappedBy = "solucion", fetch = FetchType.EAGER, cascade = CascadeType.MERGE)
......@@ -36,8 +37,9 @@ public class Solucion {
}
Solucion(Integer idEncuesta, List<Respuesta> elementos, Long inicio, Long fin) {
Solucion(Integer idEncuesta, String user, List<Respuesta> elementos, Long inicio, Long fin) {
this.idEncuesta = idEncuesta;
this.user = user;
this.inicio = inicio;
this.fin = fin;
}
......@@ -50,6 +52,14 @@ public class Solucion {
this.id = id;
}
public String getUser() {
return this.user;
}
public void setUser(String user) {
this.user = user;
}
public Integer getIdEncuesta() {
return this.idEncuesta;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment