Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Rename Fees to Revenue and add Event Date in Admin Sales Fees. #3211

Merged
merged 7 commits into from
Jul 6, 2019

Conversation

Anupam-dagar
Copy link
Member

Reference: #3173

Short description of what this resolves:

Currently there is no event date in the table of fees in admin sales section. This PR adds an event date to the table of fees in admin sales section. Also the Fees is renamed to Revenue.

Changes proposed in this pull request:

  • Rename Fees to Revenue.
  • Fetch events model along with admin-sales-fee model.
  • Sort both models by name so that while adding event date for an event in admin-sales-fee, mismatch of event isn't there.
  • Add aftermodel to add event date to admin-sales-fee model.
  • Make relevant changes in the frontend.

Checklist

  • I have read the Contribution & Best practices Guide.
  • My branch is up-to-date with the Upstream development branch.
  • The acceptance, integration, unit tests and linter pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Screenshots

Screenshot from 2019-06-28 01-41-57

@Anupam-dagar Anupam-dagar changed the title enh: Rename Fees to Revenue and add Event Date in Admin Sales Fees. feat: Rename Fees to Revenue and add Event Date in Admin Sales Fees. Jun 27, 2019
@auto-label auto-label bot added the feature label Jun 27, 2019

export default Route.extend({
titleToken() {
return this.l10n.t('Fees');
return this.l10n.t('Revenue');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The route name also should chan ge

},

model() {
return this.store.findAll('admin-sales-fee');
return RSVP.hash({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use async-await instead of RSVP.hash

},

afterModel(model) {
model.orders.forEach((data, index) => data.set('eventDate', model.events[index].startsAtDate));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this in model

model.orders.forEach((data, index) => data.set('eventDate', model.events[index].startsAtDate));
},

setupController(controller, model) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not do this.

@Anupam-dagar
Copy link
Member Author

@niranjan94 This is ready for another review.

async model() {
let orders = await this.store.findAll('admin-sales-fee', { reload: true }).then(orders => orders.sortBy('name'));
let events = await this.store.findAll('event', { reload: true }).then(events => events.sortBy('name'));
orders.forEach((data, index) => data.set('eventDate', events[index].startsAtDate));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not assume the indexes of both orders and events match. (ie) for example, do not assume orders[0] matches with events[0]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I actually assumed it on the basis that I sorted them on the basis of name. I guess name in orders and events are event name only, right? I wasn't able to find another way to get event date as their is no relation to event in orders model. Maybe we can discuss this in tomorrow's meeting.

@Anupam-dagar
Copy link
Member Author

This PR has now a dependency on corresponding server PR fossasia/open-event-server#6135

},

model() {
async model() {
return this.store.findAll('admin-sales-fee');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not required here, if you are not using await.

},

model() {
async model() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

async not needed

@@ -1,11 +1,13 @@
import attr from 'ember-data/attr';
import ModelBase from 'open-event-frontend/models/base';
import moment from 'moment';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Never used. Please remove this as travis is failing due to this

@Anupam-dagar
Copy link
Member Author

This PR is ready for another review.

Copy link
Contributor

@abhinavk96 abhinavk96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Has the field already been added on server?

@Anupam-dagar
Copy link
Member Author

@CosmicCoder96 yes the server PR is merged.

@mariobehling mariobehling requested a review from uds5501 July 5, 2019 08:34
Copy link
Member

@mrsaicharan1 mrsaicharan1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@Anupam-dagar
Copy link
Member Author

can we merge this?

@abhinavk96 abhinavk96 merged commit f29899b into fossasia:development Jul 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants