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

EventCalendar screen failing to open. #2328

Closed
Azad99-9 opened this issue Jan 15, 2024 · 18 comments · Fixed by #2352 or #2405
Closed

EventCalendar screen failing to open. #2328

Azad99-9 opened this issue Jan 15, 2024 · 18 comments · Fixed by #2352 or #2405
Assignees
Labels
bug Something isn't working feature request no-issue-activity No issue activity

Comments

@Azad99-9
Copy link

Describe the bug
The EventCalendar screen is failing to open when the ExploreEvents screen is not empty.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to Explore Events Page.
  2. Create a new event.
  3. Navigate back to Explore Events Page.
  4. Open Event Calendar page by clicking on calendar icon.

Expected behavior
Screenshot_20240116-001427

Actual behavior
Screenshot_20240116-001659

Screenshots
If applicable, add screenshots to help explain your problem.

Additional details
Add any other context or screenshots about the feature request here.

Potential internship candidates
Please read this if you are planning to apply for a Palisadoes Foundation internship #359

@Azad99-9 Azad99-9 added the bug Something isn't working label Jan 15, 2024
@github-actions github-actions bot added feature request unapproved Unapproved, needs to be triaged labels Jan 15, 2024
@Manik2708
Copy link

Can I work on this issue? @palisadoes @noman2002

@Cioppolo14 Cioppolo14 removed the unapproved Unapproved, needs to be triaged label Jan 16, 2024
@Cioppolo14
Copy link

@Azad99-9 I cannot tell if you wanted to work on this issue or not. Did you want to work on this issue?

@Azad99-9
Copy link
Author

Azad99-9 commented Jan 16, 2024

@Cioppolo14 Thanks.
no problem, you can assign it to @Manik2708 .

@abhisheksharma010
Copy link

Hello @Cioppolo14 , can you assign this issue to me? I can easily resolve this.

@Manik2708 Manik2708 removed their assignment Jan 22, 2024
@Manik2708
Copy link

Manik2708 commented Jan 22, 2024

Unassigned myself, as I am working on a Talawa API issue. Sorry for this. Please assign it somebody else.

@AVtheking
Copy link

I would like to work on this issue

@Azad99-9
Copy link
Author

Azad99-9 commented Feb 25, 2024

@palisadoes @Cioppolo14 this issue isn't completely fixed. It still persists in the app. Can you please reopen this issue.

Screenshot_20240223-162446
)

@palisadoes palisadoes reopened this Feb 25, 2024
@AVtheking
Copy link

it is not showing me error

@AVtheking
Copy link

Working fine for me

@Azad99-9
Copy link
Author

@AVtheking please confirm it from other fellow devs some of them including me are facing this issue.

@Azad99-9
Copy link
Author

@AVtheking did you find the cause of this issue.

@AVtheking
Copy link

@Azad99-9 sorry I was busy and haven't look into it.

@Azad99-9
Copy link
Author

@AVtheking no worries I have found the cause of the issue. Would send you the fix you raise a PR for the same👍

@AVtheking
Copy link

Instead of me raising the PR I unassign myself and let you get assigned and raise a PR to fix this

@Azad99-9
Copy link
Author

@AVtheking actually i got already 2 issues assigned.

@AVtheking
Copy link

Me also ok no worries I will raise the PR

@Azad99-9
Copy link
Author

Azad99-9 commented Feb 29, 2024

navigate to lib/views/after_auth_screens/events/event_calendar.dart

modify _getCalendarDataSource method as shown below.

_AppointmentDataSource _getCalendarDataSource(List<Event> eventsList) {
  final appointments = <Appointment>[];
  final colors = [
    Colors.green,
    Colors.blue,
    Colors.red,
    Colors.orange,
    Colors.purple,
    Colors.pink,
  ];
  int index = 0;
  // looping through all the events created in the organization.
  eventsList.forEach((event) {
    DateTime? startDate;
    DateTime? endDate;

    /// change made here, code related to the fix.
    if (event.startDate!.contains('/')) {
      startDate = DateFormat('MM/dd/yyyy').parse(event.startDate!);
    } else {
      startDate = DateFormat('yyyy-MM-dd').parse(event.startDate!);
    }

    /// change made here, code related to the fix.
    if (event.endDate!.contains('/')) {
      endDate = DateFormat('MM/dd/yyyy').parse(event.endDate!);
    } else {
      endDate = DateFormat('yyyy-MM-dd').parse(event.endDate!);
    }

    print("${event.startTime!}##############################");
    final startTime = parseTime(event.startTime ?? '14:23:01');
    final endTime = parseTime(event.endTime ?? '21:23:01');

    // adding appointments on the calender for event[index] date time.
    appointments.add(
      Appointment(
        startTime: startDate
            .add(Duration(hours: startTime.hour, minutes: startTime.minute)),
        endTime:
            endDate.add(Duration(hours: endTime.hour, minutes: endTime.minute)),
        subject: event.title!,
        color: colors[index % colors.length],
        location: event.location,
        id: event.id,
      ),
    );
    index++;
  });

  return _AppointmentDataSource(appointments);
}

Cause: We are getting 2 different formats of Date from eventList.

  1. YYYY-MM-DD
  2. YYYY/MM/DD

so the parseTime method is facing issue while parsing these fomats. I have added 2 if else blocks to handle these two types of formats.

Copy link

This issue did not get any activity in the past 10 days and will be closed in 180 days if no update occurs. Please check if the develop branch has fixed it and report again or close the issue.

@github-actions github-actions bot added the no-issue-activity No issue activity label Mar 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature request no-issue-activity No issue activity
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants