Skip to content

Commit bb4aef5

Browse files
committed
Document ReturnSubmissionModel methods
1 parent 969478b commit bb4aef5

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

app/models/return-submission.model.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ class ReturnSubmissionModel extends BaseModel {
4242
}
4343
}
4444

45+
/**
46+
* Applies meter readings to return submission lines
47+
*/
4548
$applyReadings() {
4649
const meter = this.$meter()
4750

@@ -59,6 +62,11 @@ class ReturnSubmissionModel extends BaseModel {
5962
}
6063
}
6164

65+
/**
66+
* Returns the first meter from the return submission's metadata, or null if no meters exist.
67+
*
68+
* @returns {?object} The first meter, or null.
69+
*/
6270
$meter() {
6371
if (!this.metadata?.meters) {
6472
return null
@@ -67,6 +75,12 @@ class ReturnSubmissionModel extends BaseModel {
6775
return this.metadata.meters[0]
6876
}
6977

78+
/**
79+
* Returns the method of measurement from the return submission's metadata, defaulting to 'abstractionVolumes' if none
80+
* is specified.
81+
*
82+
* @returns {string} The method of measurement.
83+
*/
7084
$method() {
7185
if (!this.metadata?.method) {
7286
return 'abstractionVolumes'
@@ -75,6 +89,11 @@ class ReturnSubmissionModel extends BaseModel {
7589
return this.metadata.method
7690
}
7791

92+
/**
93+
* Returns the unit of measurement from the return submission's metadata, defaulting to cubic metres if not specified.
94+
*
95+
* @returns {string} The unit of measurement.
96+
*/
7897
$units() {
7998
if (!this.metadata?.units) {
8099
return unitNames.CUBIC_METRES

0 commit comments

Comments
 (0)