Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Commit

Permalink
Critical bugfix for review form submission, fixed avg star text
Browse files Browse the repository at this point in the history
handleSubmit was not bound to `this`, resulting in no context being passed.
  • Loading branch information
firebolt55439 committed Sep 19, 2017
1 parent b01d505 commit 2604fa9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/CourseInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class CourseInfo extends Component {
const courseRef = firebase.database().ref().child('courses').child(this.course);
courseRef.on('value', (data) => {
// const dataValue = data.val();
// console.log("GOT", data);
data = data.val();
const reviewAverage = data.totalStars / data.totalReviews;
if (Number.isNaN(reviewAverage)) {
that.averageStars = 'No reviews yet.';
Expand Down
4 changes: 2 additions & 2 deletions src/ReviewForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default class ReviewForm extends Component {
constructor(props) {
super(props);
console.log(props);
this.handleSubmit.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
this.state_props = props;
this.course = this.state_props.course;
this.submitted = undefined;
Expand All @@ -33,7 +33,7 @@ export default class ReviewForm extends Component {

handleSubmit(event) {
event.preventDefault();
const that = this;
var that = this;
firebase.auth().onAuthStateChanged((user) => {
if (user) {
const displayName = user.displayName;
Expand Down

0 comments on commit 2604fa9

Please sign in to comment.