Switch to skill level

This commit is contained in:
Chris Blanchard 2015-08-30 00:46:16 +01:00
parent d699c0096b
commit 17ff3b06cc
3 changed files with 12 additions and 10 deletions

View File

@ -14,7 +14,8 @@ var profileSchema = new Schema({
commander: { type: Boolean, default: false }
},
enslo: { type: Number, default: null },
division: { type: String, default: null }
division: { type: String, default: null },
skill: { type: String, default: null }
});
profileSchema.path('userId').index({ unique: true });
@ -38,7 +39,7 @@ profileSchema.method({
toJson: () => {
let output = {};
output.abilities = this.abilities;
output.division = this.division;
output.skill = this.skill;
return output;
}
});

View File

@ -633,8 +633,8 @@ var Gatherers = React.createClass({
alt={gatherer.user.country} />);
};
if (gatherer.user.profile.division) {
var division = (<span className="label label-primary">{gatherer.user.profile.division}</span>);
if (gatherer.user.profile.skill) {
var skill = (<span className="label label-primary">{gatherer.user.profile.skill}</span>);
}
var abilities = [];
@ -686,7 +686,7 @@ var Gatherers = React.createClass({
<tr key={gatherer.user.id} data-userid={gatherer.user.id}>
<td className="col-md-9">
<p className="gatherer">{gatherer.user.username}</p>
<p className="gatherer">{country} {lifeform} {division} {team}</p>
<p className="gatherer">{country} {lifeform} {skill} {team}</p>
</td>
<td className="col-md-3 text-right">{action}&nbsp;</td>
</tr>

View File

@ -109,12 +109,12 @@ var ProfileModal = React.createClass({
onos: React.findDOMNode(this.refs.onos).checked,
commander: React.findDOMNode(this.refs.commander).checked
};
let division = React.findDOMNode(this.refs.playerskill).value;
let skill = React.findDOMNode(this.refs.playerskill).value;
socket.emit("users:update:profile", {
id: this.props.user.id,
profile: {
abilities: abilities,
division: division
skill: skill
}
});
},
@ -134,10 +134,10 @@ var ProfileModal = React.createClass({
);
}
let division = this.props.user.profile.division;
let division = this.props.user.profile.skill;
let skillLevels = ["Div 1", "Div 2", "Div 3", "Div 4"].map(skill => {
if (skill === division) {
let skillLevels = ["Low Skill", "Medium Skill", "High Skill"].map(skill => {
if (skill === skill) {
return <option defaultValue key={skill}>{skill}</option>
} else {
return <option key={skill}>{skill}</option>
@ -151,6 +151,7 @@ var ProfileModal = React.createClass({
<select className="form-control" ref="playerskill">
{skillLevels}
</select>
<p><small>Try to give an accurate representation of your skill to raise the quality of your gathers</small></p>
</div>
<div className="form-group">
{abilitiesForm}