Skip to content

Commit

Permalink
Merge pull request #5 from AndrewHUNGNguyen/master
Browse files Browse the repository at this point in the history
Fixes to save correct graduation year
  • Loading branch information
gregv authored Jul 31, 2024
2 parents 21d416f + 8d06d81 commit 1a23fb2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
16 changes: 8 additions & 8 deletions app/client/views/application/application.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,14 @@
<label>Graduation Year</label>
<select name="year" ng-model="user.profile.graduationYear">
<option value="">Graduation Year</option>
<option value="2016">2020</option>
<option value="2017">2021</option>
<option value="2018">2022</option>
<option value="2019">2023</option>
<option value="2016">2024</option>
<option value="2017">2025</option>
<option value="2018">2026</option>
<option value="2019">2027</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
<option value="2024">2024</option>
<option value="2025">2025</option>
<option value="2026">2026</option>
<option value="2027">2027</option>
</select>
</div>

Expand Down
6 changes: 4 additions & 2 deletions app/server/models/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,13 +326,15 @@ schema.statics.getByToken = function (token, callback) {
};

schema.statics.validateProfile = function (profile, cb) {
var validYears = ["2020", "2021", "2022", "2023", "2024", "2025", "2026", "2027"];
var validGenders = ["M", "F", "O", "N"];
return cb(
!(
profile.name.length > 0 &&
profile.adult &&
profile.school.length > 0 &&
["2016", "2017", "2018", "2019"].indexOf(profile.graduationYear) > -1 &&
["M", "F", "O", "N"].indexOf(profile.gender) > -1
validYears.indexOf(profile.graduationYear) > -1 &&
validGenders.indexOf(profile.gender) > -1
)
);
};
Expand Down

0 comments on commit 1a23fb2

Please sign in to comment.