BspbOrg / members-server

Management system for BSPB members
GNU Affero General Public License v3.0
0 stars 0 forks source link

Feature/reminder email before expire #39

Closed herra closed 5 years ago

herra commented 5 years ago

Define a task that is scheduled once a day and send email to members with expiring membership within the next month.

Emails are sent only to members that have paid personally their last membership - i.e. family members and group payment members will not receive emails.

A user will receive only once email for a particular expiration date.

Environment configuration:

Email template is aboutToExpire

codecov[bot] commented 5 years ago

Codecov Report

Merging #39 into master will increase coverage by 1.04%. The diff coverage is 96.36%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #39      +/-   ##
==========================================
+ Coverage   87.95%   88.99%   +1.04%     
==========================================
  Files          77       83       +6     
  Lines        1328     1499     +171     
  Branches      180      201      +21     
==========================================
+ Hits         1168     1334     +166     
- Misses        138      142       +4     
- Partials       22       23       +1
Impacted Files Coverage Δ
test/matchers/index.js 100% <ø> (ø) :arrow_up:
models/member.js 88.46% <ø> (-1.29%) :arrow_down:
test/ah-setup.js 66.66% <100%> (ø) :arrow_up:
tasks/ExpirationReminder.js 100% <100%> (ø)
classes/MembershipExpirationProcessor.js 100% <100%> (ø)
initializers/expirationReminder.js 100% <100%> (ø)
config/expirationReminder.js 100% <100%> (ø)
...s/20181022223444-add-notified-for-expiring-date.js 66.66% <66.66%> (ø)
test/matchers/toBeSameDay.js 83.33% <83.33%> (ø)
... and 10 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5a2205e...99adb53. Read the comment docs.

groupsky commented 5 years ago

@herra I did rebase from master instead of merging it, so you need to rebase your local branch

groupsky commented 5 years ago

@herra i refactor the task so it just starts the operation and the logic is within MembershipExpirationProcessor. I think this is enough for now, but for #40 there should be some more refactoring. I think if the processMemberships is split into two methods - one to gather all members with expiring membership within certain period, and another that filters members who are paying (essentially the first and second part of the method), would make it more reusable.

Another refactor for #40 should be to merge MembershipExpirationProcessor and Membersip classes as essentially both are handling logic with membership.