Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hoorayimhelping/c1021d36d6945a154de341770eb58e12 to your computer and use it in GitHub Desktop.
Save hoorayimhelping/c1021d36d6945a154de341770eb58e12 to your computer and use it in GitHub Desktop.
diff --git a/static/jsx/leasing/rate.jsx b/static/jsx/leasing/rate.jsx
index 0dd9b6da2..c3df9ab02 100644
--- a/static/jsx/leasing/rate.jsx
+++ b/static/jsx/leasing/rate.jsx
@@ -1,24 +1,39 @@
// See realestate_db/models Rate class
class RateModel {
+ static Flat = 'Flat';
+ static IG = 'IG';
+ static IGUnknownPass = 'IGUnknownPass';
+ static MG = 'MG';
+ static MGUnknownPass = 'MGUnknownPass';
+ static Net = 'Net';
+ static NetUnknownPass = 'NetUnknownPass';
+ static N = 'N';
+ static NN = 'NN';
+ static NNUnknownPass = 'NNUnknownPass';
+ static NNN = 'NNN';
+ static NNNUnknownPass = 'NNNUnknownPass';
+ static Unknown = 'Unknown';
+ static UnknownWithRate = 'UnknownWithRate';
+
// Returns a list of types that shouldn't be selectable in the UI.
static get disabledRateTypes() {
- return ['Unknown', 'UnknownWithRate'];
+ return [RateModel.Unknown, RateModel.UnknownWithRate];
}
// Returns a list of rate types that have passthroughs/expenses associated with them.
static get passthroughTypes() {
return [
- 'IG',
- 'IGUnknownPass',
- 'MG',
- 'MGUnknownPass',
- 'Net',
- 'NetUnknownPass',
- 'N',
- 'NN',
- 'NNUnknownPass',
- 'NNN',
- 'NNNUnknownPass',
+ RateModel.IG,
+ RateModel.IGUnknownPass,
+ RateModel.MG,
+ RateModel.MGUnknownPass,
+ RateModel.Net,
+ RateModel.NetUnknownPass,
+ RateModel.N,
+ RateModel.NN,
+ RateModel.NNUnknownPass,
+ RateModel.NNN,
+ RateModel.NNNUnknownPass,
];
}
@@ -29,48 +44,48 @@ class RateModel {
}
switch (rateType) {
- case 'Net':
- case 'NetUnknownPass': {
- return 'Net';
+ case RateModel.Net:
+ case RateModel.NetUnknownPass: {
+ return RateModel.Net;
}
- case 'IG':
- case 'IGUnknownPass': {
- return 'IG';
+ case RateModel.IG:
+ case RateModel.IGUnknownPass: {
+ return RateModel.IG;
}
- case 'MG':
- case 'MGUnknownPass': {
- return 'MG';
+ case RateModel.MG:
+ case RateModel.MGUnknownPass: {
+ return RateModel.MG;
}
- case 'NN':
- case 'NNUnknownPass': {
- return 'NN';
+ case RateModel.NN:
+ case RateModel.NNUnknownPass: {
+ return RateModel.NN;
}
- case 'NNN':
- case 'NNNUnknownPass': {
- return 'NNN';
+ case RateModel.NNN:
+ case RateModel.NNNUnknownPass: {
+ return RateModel.NNN;
}
- case 'N':
+ case RateModel.N:
default: {
- return 'N';
+ return RateModel.N;
}
}
}
// Returns a list of types that use total_rate instead of asking_rate.
static get totalRateTypes() {
- return ['Flat'];
+ return [RateModel.Flat];
}
constructor(rate) {
this.rate = rate;
this.timeUnit = 'yearly';
- if (this.rate.rate_type === 'Flat') {
+ if (this.rate.rate_type === RateModel.Flat) {
this.timeUnit = 'monthly';
}
@@ -88,7 +103,7 @@ class RateModel {
}
let addon = 'SF/YR';
- if (this.rate.rate_type === 'Flat') {
+ if (this.rate.rate_type === RateModel.Flat) {
addon = 'MO';
}
@@ -147,59 +162,59 @@ class RateModel {
}
switch (this.rate.rate_type) {
- case 'Net':
- case 'NetUnknownPass': {
+ case RateModel.Net:
+ case RateModel.NetUnknownPass: {
if (!this.rate.pass_throughs) {
- this.rate.rate_type = 'NetUnknownPass';
+ this.rate.rate_type = RateModel.NetUnknownPass;
return;
}
- this.rate.rate_type = 'Net';
+ this.rate.rate_type = RateModel.Net;
break;
}
- case 'IG':
- case 'IGUnknownPass': {
+ case RateModel.IG:
+ case RateModel.IGUnknownPass: {
if (!this.rate.pass_throughs) {
- this.rate.rate_type = 'IGUnknownPass';
+ this.rate.rate_type = RateModel.IGUnknownPass;
return;
}
- this.rate.rate_type = 'IG';
+ this.rate.rate_type = RateModel.IG;
break;
}
- case 'MG':
- case 'MGUnknownPass': {
+ case RateModel.MG:
+ case RateModel.MGUnknownPass: {
if (!this.rate.pass_throughs) {
- this.rate.rate_type = 'MGUnknownPass';
+ this.rate.rate_type = RateModel.MGUnknownPass;
return;
}
- this.rate.rate_type = 'MG';
+ this.rate.rate_type = RateModel.MG;
break;
}
- case 'NN':
- case 'NNUnknownPass': {
+ case RateModel.NN:
+ case RateModel.NNUnknownPass: {
if (!this.rate.pass_throughs) {
- this.rate.rate_type = 'NNUnknownPass';
+ this.rate.rate_type = RateModel.NNUnknownPass;
return;
}
- this.rate.rate_type = 'NN';
+ this.rate.rate_type = RateModel.NN;
break;
}
- case 'NNN':
- case 'NNNUnknownPass': {
+ case RateModel.NNN:
+ case RateModel.NNNUnknownPass: {
if (!this.rate.pass_throughs) {
- this.rate.rate_type = 'NNNUnknownPass';
+ this.rate.rate_type = RateModel.NNNUnknownPass;
return;
}
- this.rate.rate_type = 'NNN';
+ this.rate.rate_type = RateModel.NNN;
break;
}
- case 'N':
+ case RateModel.N:
default: {
- this.rate.rate_type = 'N';
+ this.rate.rate_type = RateModel.N;
}
}
}
@@ -223,8 +238,8 @@ class RateModel {
// Changing the value of rate can change the type of rate for certain rates.
transitionRateTypes() {
- if (this.rate.rate_type === 'Unknown' && this.rate.asking_rate) {
- this.rate.rate_type = 'UnknownWithRate';
+ if (this.rate.rate_type === RateModel.Unknown && this.rate.asking_rate) {
+ this.rate.rate_type = RateModel.UnknownWithRate;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment