adjust variable names / remove duplicate return

This commit is contained in:
KDSBrowne 2018-10-30 13:17:40 +00:00
parent 3fc941bd49
commit ee41c0bd93
6 changed files with 28 additions and 33 deletions

View File

@ -1,4 +1,3 @@
import { check } from 'meteor/check';
import Polls from '/imports/api/polls';
import Logger from '/imports/startup/server/logger';

View File

@ -22,10 +22,8 @@ export default function startPoll(credentials, pollType, pollId, answers) {
if (pollType === 'custom') {
EVENT_NAME = 'StartCustomPollReqMsg';
check(answers, Array);
payload.answers = answers;
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
}
return RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);

View File

@ -86,7 +86,7 @@ class Poll extends Component {
this.nonPresenterRedirect = this.nonPresenterRedirect.bind(this);
this.getInputFields = this.getInputFields.bind(this);
this.handleInputChange = this.handleInputChange.bind(this);
this.back = this.back.bind(this);
this.handleBackClick = this.handleBackClick.bind(this);
}
componentWillMount() {
@ -135,9 +135,7 @@ class Poll extends Component {
this.inputEditor = [];
return customPollReq
? this.setState({ customPollReq: false })
: this.setState({ customPollReq: true });
return this.setState({ customPollReq: !this.state.customPollReq });
}
renderQuickPollBtns() {
@ -187,7 +185,7 @@ class Poll extends Component {
);
}
back() {
handleBackClick() {
const { stopPoll } = this.props;
stopPoll();
@ -216,7 +214,7 @@ class Poll extends Component {
getUser,
currentPoll,
}}
back={this.back}
handleBackClick={this.handleBackClick}
/>
</div>
);

View File

@ -81,10 +81,10 @@ class LiveResult extends Component {
} = currentPoll;
if (responses && answers) {
responses.map((ur) => {
responses.forEach((ur) => {
const user = getUser(ur.userId);
if (user) {
answers.map((obj) => {
answers.forEach((obj) => {
if (obj.id === ur.answerId) {
respondedUsers.push(<div className={styles.item} key={_.uniqueId('stats-')}>{user.name}</div>);
respondedUsers.push(<div className={styles.itemR} key={_.uniqueId('stats-')}>{obj.key}</div>);
@ -98,6 +98,7 @@ class LiveResult extends Component {
return respondedUsers;
}
getUnresponsive() {
const { currentPoll, getUser } = this.props;
@ -112,9 +113,8 @@ class LiveResult extends Component {
const usersList = _.compact(users);
if (usersList) {
usersList.map((userId) => {
usersList.forEach((userId) => {
const user = getUser(userId);
if (user && user.connectionStatus == 'online') {
usersToRespond.push(<div className={styles.item} key={_.uniqueId('stats-')}>{user.name}</div>);
usersToRespond.push(<div className={styles.itemR} key={_.uniqueId('stats-')}>-</div>);
@ -127,7 +127,7 @@ class LiveResult extends Component {
render() {
const {
intl, publishPoll, stopPoll, back,
intl, publishPoll, stopPoll, handleBackClick,
} = this.props;
return (
@ -149,7 +149,7 @@ class LiveResult extends Component {
/>
<Button
onClick={() => {
back();
handleBackClick();
}}
label={intl.formatMessage(intlMessages.backLabel)}
color="default"

View File

@ -1,12 +1,12 @@
@import "/imports/ui/stylesheets/variables/_all";
:root {
--stats-border-color: #d4d9df;
--stats-option-width: 4em;
--stats-element-width: 17%;
--poll-stats-border-color: #d4d9df;
--poll-stats-option-width: 4em;
--poll-stats-element-width: 17%;
--sm-margin: 0.3125rem;
--user-line-height: 1.75rem;
--poll-sm-margin: 0.3125rem;
--poll-user-line-height: 1.75rem;
}
.btn {
@ -30,8 +30,8 @@
.right,
.center {
padding: var(--sm-padding-y);
margin-top: var(--sm-margin);
margin-bottom: var(--sm-margin);
margin-top: var(--poll-sm-margin);
margin-bottom: var(--poll-sm-margin);
color: var(--color-text);
}
@ -39,11 +39,11 @@
.right {
flex: 0 0 auto;
position: relative;
min-width: var(--stats-element-width);
min-width: var(--poll-stats-element-width);
}
.left {
width: var(--stats-option-width);
width: var(--poll-stats-option-width);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
@ -52,7 +52,7 @@
.right {
text-align: right;
max-width: var(--stats-element-width);
max-width: var(--poll-stats-element-width);
}
.container,
@ -63,7 +63,7 @@
.stats {
display: flex;
flex-direction: column;
border: 1px solid var(--stats-border-color);
border: 1px solid var(--poll-stats-border-color);
border-radius: var(--border-size-large);
padding: var(--md-padding-x);
@ -100,11 +100,11 @@
.item,
.itemR {
width: 50%;
line-height: var(--user-line-height);
line-height: var(--poll-user-line-height);
}
.item,
.itemR {
line-height: var(--user-line-height);
line-height: var(--poll-user-line-height);
color: var(--color-text);
}

View File

@ -2,9 +2,9 @@
@import "/imports/ui/stylesheets/mixins/focus";
:root {
--column-amount: 2;
--poll-column-amount: 2;
--poll-blue: #1A73D4;
--headerOffset: -0.875rem;
--poll-header-offset: -0.875rem;
}
.closeBtn {
@ -63,7 +63,7 @@
.header {
position: relative;
top: var(--headerOffset);
top: var(--poll-header-offset);
display: flex;
flex-direction: row;
align-items: center;
@ -78,14 +78,14 @@
.grid {
display: grid;
grid-template-columns: repeat(var(--column-amount), 1fr);
grid-template-columns: repeat(var(--poll-column-amount), 1fr);
> pollBtn:nth-child(odd) {
grid-column: 1;
}
> pollBtn:nth-child(even) {
grid-column: var(--column-amount);
grid-column: var(--poll-column-amount);
}
}