6 Commits
v1.6 ... master

Author SHA1 Message Date
Luca Jäntsch
4b810f3828 Merge branch '2-gruppenmodus-bilder-2' into 'master'
gruppenmodus fix

Closes #2

See merge request theenoro/random-user!4
2019-08-26 20:13:51 +02:00
Luca Jäntsch
b23e97cf78 gruppenmodus fix 2019-08-26 20:13:10 +02:00
Theenoro
2fc95b9682 disabled logs 2019-08-17 16:16:49 +02:00
Theenoro
771b1558b7 fixed class name value 2019-08-17 16:01:48 +02:00
Theenoro
bcf8fc8acf fixed class name value 2019-08-17 15:44:34 +02:00
Luca Jäntsch
6a929b51be Aktualisieren README.md 2019-08-16 15:43:12 +02:00
5 changed files with 32 additions and 27 deletions

View File

@@ -1,8 +1,6 @@
# Random user # Random user
Online preview: http://theenoro.the-co.de/random-user/ Online preview: http://theenoro.the-co.de/random-user/
## Download ## Download
### Build yourself ### Build yourself
NodeJS: https://nodejs.org/en/ NodeJS: https://nodejs.org/en/
@@ -19,14 +17,15 @@ lessc src_less/main.less build/main.css
mv public build mv public build
``` ```
### Latest Artifact ### Latest Artifact
witout building - just download and put into webfolder.
https://gitlab.thee.moe/theenoro/random-user/-/jobs/artifacts/master/download?job=pages https://gitlab.thee.moe/theenoro/random-user/-/jobs/artifacts/master/download?job=pages
## Usage ## Usage
### Get it running ### Get it running
Just use a simple webserver, if you want to use the rescan.php then you need php-cli or something like apache/nginx with the php module. Just use a simple webserver, if you want to use the rescan.php then you need php-cli or something like apache/nginx with the php module.
### Create new Classes / Usergroups w/o rescan.php ### Create new Classes / Usergroups w/o rescan.php
1. create in `build/data/class` a new folder for a new group of users 1. create in `public/data/class` a new folder for a new group of users
2. modify the `classes.json` in `build/data/class` and add in the array your ne folder name 2. modify the `classes.json` in `public/data/class` and add in the array your ne folder name
3. create in your new folder a file with the name 'user.json' and a structure like 3. create in your new folder a file with the name 'user.json' and a structure like
```json ```json
{"user":[ {"user":[
@@ -37,6 +36,7 @@ Just use a simple webserver, if you want to use the rescan.php then you need php
``` ```
### Create new Classes / Usergroups w/ rescan.php ### Create new Classes / Usergroups w/ rescan.php
1. create in `build/data/class` a new folder for a new group of users 1. (for the web rescan)go to public/ and run `chown -R www-data:www-data class` that the user www-data owns the folder and can write files.
2. run in the build folder `php ./rescan.php`, it will generate the `classes.json` and all `user.json` files for you 2. create in `public/data/class` a new folder for a new group of users
3. run in the public folder `php ./rescan.php`, it will generate the `classes.json` and all `user.json` files for you. Or get on your website https://yourdoma.in/rescan.php

13
package-lock.json generated
View File

@@ -6630,7 +6630,8 @@
}, },
"ansi-regex": { "ansi-regex": {
"version": "2.1.1", "version": "2.1.1",
"bundled": true "bundled": true,
"optional": true
}, },
"aproba": { "aproba": {
"version": "1.2.0", "version": "1.2.0",
@@ -6995,7 +6996,8 @@
}, },
"safe-buffer": { "safe-buffer": {
"version": "5.1.2", "version": "5.1.2",
"bundled": true "bundled": true,
"optional": true
}, },
"safer-buffer": { "safer-buffer": {
"version": "2.1.2", "version": "2.1.2",
@@ -7043,6 +7045,7 @@
"strip-ansi": { "strip-ansi": {
"version": "3.0.1", "version": "3.0.1",
"bundled": true, "bundled": true,
"optional": true,
"requires": { "requires": {
"ansi-regex": "^2.0.0" "ansi-regex": "^2.0.0"
} }
@@ -7081,11 +7084,13 @@
}, },
"wrappy": { "wrappy": {
"version": "1.0.2", "version": "1.0.2",
"bundled": true "bundled": true,
"optional": true
}, },
"yallist": { "yallist": {
"version": "3.0.3", "version": "3.0.3",
"bundled": true "bundled": true,
"optional": true
} }
} }
} }

View File

@@ -39,21 +39,21 @@ export class Main extends React.Component{
} }
selCh(e){ selCh(e){
console.log(e.target.value); //console.log(e.target.value);
var v = e.target.value; var v = e.target.value;
var me = this; var me = this;
if(v!=='-'){ if(v!=='-'){
Students_loader.loadStudents(e.target.value,(data)=>{ Students_loader.loadStudents(e.target.value,(data)=>{
console.log(data) //console.log(data)
User.user_arr = []; User.user_arr = [];
me.setState({students:[],stud_html:[]}); me.setState({students:[],stud_html:[]});
var ht = []; var ht = [];
console.log(v) //console.log(v)
data.user.map((cl,i)=> data.user.map((cl,i)=>
ht.push(<Student username={cl} cl={v} i={i}></Student>) ht.push(<Student username={cl} cl={v} i={i}></Student>)
) )
console.log(ht[0]) //console.log(ht[0])
me.setState({students:data.user,selected:v,stud_html:ht}) me.setState({students:data.user,selected:v,stud_html:ht})
}) })
}else{ }else{
@@ -85,7 +85,7 @@ export class Main extends React.Component{
var x = Math.floor(Math.random()*users); var x = Math.floor(Math.random()*users);
if(already_picked.indexOf(x)===-1){ if(already_picked.indexOf(x)===-1){
already_picked.push(x); already_picked.push(x);
console.log(x); //console.log(x);
User.user_arr[x].disappear(); User.user_arr[x].disappear();
pushed = true; pushed = true;
} }
@@ -102,7 +102,7 @@ export class Main extends React.Component{
openGrpGui(){ openGrpGui(){
if(this.state.grp_gui==='invi'){ if(this.state.grp_gui==='invi'){
this.setState({grp_gui:'vi',"css":".group{opacity:1}"}); this.setState({grp_gui:'vi',"css":".group{opacity:1} .user.disappear{opacity: 1 !important; }"});
}else{ }else{
this.setState({grp_gui:'invi',"css":".group{opacity:0}"}); this.setState({grp_gui:'invi',"css":".group{opacity:0}"});
@@ -123,7 +123,7 @@ export class Main extends React.Component{
for(var i = 0; i<this.state.students.length;i++){ for(var i = 0; i<this.state.students.length;i++){
var grp = Math.floor(Math.random()*mk_groups); var grp = Math.floor(Math.random()*mk_groups);
if(this.state.students.length-1-fill>=i || tmp_map['grp_'+grp].length<mk_groups){ if(this.state.students.length-1-fill>=i || tmp_map['grp_'+grp].length<mk_groups){
console.log("TEST") //console.log("TEST")
var g = false; var g = false;
var y = 0; var y = 0;
while(g===false){ while(g===false){
@@ -132,13 +132,13 @@ export class Main extends React.Component{
g=true; g=true;
} }
if(y>100){ if(y>100){
console.log("ESC"); //console.log("ESC");
break; break;
} }
y++; y++;
} }
}else{ }else{
console.log("FILL") //console.log("FILL")
} }
User.user_arr[i].setGroup(grp) User.user_arr[i].setGroup(grp)
tmp_map["grp_"+grp].push( User.user_arr[i]); tmp_map["grp_"+grp].push( User.user_arr[i]);
@@ -146,11 +146,11 @@ export class Main extends React.Component{
} }
console.log("INFO"); //console.log("INFO");
console.log(tmp_map) //console.log(tmp_map)
console.log("REST " +fill); //console.log("REST " +fill);
console.log(Math.floor(this.state.students.length/this.state.grp_member)); //console.log(Math.floor(this.state.students.length/this.state.grp_member));
console.log("INFO END") //console.log("INFO END")
} }
render(){ render(){
@@ -161,7 +161,7 @@ export class Main extends React.Component{
<select className="select-wrapper" onChange={this.selCh} value={this.state.selected} title="Gruppe auswählen"> <select className="select-wrapper" onChange={this.selCh} value={this.state.selected} title="Gruppe auswählen">
<option value="-">-</option> <option value="-">-</option>
{this.state.classes.map((cl,i)=> {this.state.classes.map((cl,i)=>
<option value={cl.toLowerCase()}>{cl.toUpperCase()}</option> <option value={cl}>{cl.toUpperCase()}</option>
)} )}
</select> </select>
</div> </div>

View File

@@ -45,7 +45,7 @@ export class Student extends React.Component{
var c = "user chosen_"+this.state.num+' '+this.state.dis; var c = "user chosen_"+this.state.num+' '+this.state.dis;
return ( return (
<div className={c}> <div className={c}>
<div className="group">{this.state.group}</div> <div className="group">{this.state.group+1}</div>
<div className="user_img"><img src={this.state.img_url} onError={this.onErr} alt=""></img></div> <div className="user_img"><img src={this.state.img_url} onError={this.onErr} alt=""></img></div>
<div className="username">{this.state.username}</div> <div className="username">{this.state.username}</div>
</div> </div>

View File

@@ -20,4 +20,4 @@
color: #FFF; color: #FFF;
} }
} }