Skip to content

Commit

Permalink
Closes #540 - Fix ws_protocol params to report page - Fix report page
Browse files Browse the repository at this point in the history
  • Loading branch information
FedeG committed Apr 15, 2019
1 parent ae71bb7 commit 35304ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 6 additions & 5 deletions eventol/front/src/containers/Report/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default class Report extends React.Component {
).catch(err => Logger.error(gettext('There has been an error'), err));
}

loadContent(pageSize, page, sorted){
loadContent = (pageSize, page, sorted) => {
const offset = page * pageSize;
let queryParams = `limit=${pageSize}&offset=${offset}&fields=${REPORT_REQUIRED_FIELDS}`;
if (sorted && sorted.length > 0){
Expand Down Expand Up @@ -134,7 +134,7 @@ export default class Report extends React.Component {
const {eventsPrivateData} = this.props;
const privateData = _.find(eventsPrivateData, {id: event.id});
const {location, report: {attendee}} = event;
event = {
const eventData = {
locationDetail: {
address_detail: location.slice(0, -3).join(' '),
address: location[location.length - 3],
Expand All @@ -149,8 +149,8 @@ export default class Report extends React.Component {
},
...event,
};
if (privateData) return {...privateData, ...event};
return event;
if (privateData) return {...privateData, ...eventData};
return eventData;
}

fetchData = ({
Expand All @@ -159,7 +159,8 @@ export default class Report extends React.Component {
this.setState({loading: true});
this.loadContent(pageSize, page, sorted, filtered).then(
({count, results}) => {
// Now just get the rows of data to your React Table (and update anything else like total pages or loading)
// Now just get the rows of data to your React Table
// (and update anything else like total pages or loading)
const quotient = Math.floor(count / pageSize);
const remainder = count % pageSize;
const pages = (remainder > 0) ? quotient + 1 : quotient;
Expand Down
3 changes: 2 additions & 1 deletion eventol/front/src/utils/urls.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import _ from 'lodash';
import {HOME_REQUIRED_FIELDS} from './constants';


Expand All @@ -21,7 +22,7 @@ export const EVENTS_WS_URL = `${WS_URL}updates/events/`;
export const getTagUrl = slug => `/tags/${slug}`;
export const getEventUrl = slug => `/events/${slug}/`;
export const getApiFullUrl = url => `/api/events/${url}`;
export const getWsUrl = (protocol = 'ws') => `${protocol}://${host}/updates/`;
export const getWsUrl = protocol => `${_.isEmpty(protocol) ? 'ws' : protocol}://${host}/updates/`;

const addSlugParams = slug => (slug ? `&tags__slug=${slug}` : '');
export const getMyEventsUrl = slug => `?my_events=true&fields=${HOME_REQUIRED_FIELDS}${addSlugParams(slug)}`;
Expand Down

0 comments on commit 35304ad

Please sign in to comment.