Skip to content

Commit

Permalink
Specify final date in logGet via end instead of finish
Browse files Browse the repository at this point in the history
  • Loading branch information
edemaine committed Apr 11, 2021
1 parent 6b2d18e commit 283b4a3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ To see every change with descriptions aimed at developers, see
As a continuously updated web app, Comingle uses dates
instead of version numbers.

## 2021-04-11

* API call `/log/get` now supports specifying the final date via
the more common `end` in addition to `finish`.

## 2021-04-10

* Comingle now remembers the meetings you've visited, and offers links to them
Expand Down
2 changes: 1 addition & 1 deletion doc/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ Request fields:
* `meeting` (required string): ID of meeting to get logs for
* `secret` (required string): The meeting secret
* `start` (optional date): Restrict to logs ≥ this date
* `finish` (optional date): Restrict to logs ≤ this date
* `end` or `finish` (optional date): Restrict to logs ≤ this date

Response fields (when `ok` is `true`):

Expand Down
6 changes: 5 additions & 1 deletion server/api.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ apiMethods =
'/tab/edit': apiEdit 'tab'
'/log/get': (options) ->
delete options.updator # for consistency across different API calls
for key in ['start', 'finish']
## Allow `finish` as an alternative to `end`
if options.finish?
options.end ?= options.finish
delete options.finish
for key in ['start', 'end']
if isDate options[key]
options[key] = new Date options[key]
logs: Meteor.call 'logGet', options
Expand Down
4 changes: 2 additions & 2 deletions server/log.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ Meteor.methods
meeting: Match.Where validId
secret: String
start: Match.Optional Date
finish: Match.Optional Date
end: Match.Optional Date
checkMeetingSecret spec.meeting, spec.secret
query = meeting: spec.meeting
query.updated = {} if spec.start? or spec.to?
query.updated.$gte = spec.start if spec.start?
query.updated.$lte = spec.finish if spec.finish?
query.updated.$lte = spec.end if spec.end?
Log.find query,
sort: updated: 1
fields:
Expand Down

0 comments on commit 283b4a3

Please sign in to comment.