Skip to content

Commit

Permalink
Volunteer Management(GSoC)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dante291 committed Sep 20, 2024
1 parent 246c5ee commit 37658db
Show file tree
Hide file tree
Showing 26 changed files with 3,434 additions and 214 deletions.
66 changes: 33 additions & 33 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name: PR Workflow
on:
pull_request:
branches-ignore:
- 'master'
- "master"

env:
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }}
Expand All @@ -30,12 +30,12 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '12.0'
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "12.0"
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.3'
channel: 'stable' # or: 'beta', 'dev' or 'master'
flutter-version: "3.22.3"
channel: "stable" # or: 'beta', 'dev' or 'master'
- name: Set default branch.
run: git remote set-head origin --auto
shell: bash
Expand All @@ -48,7 +48,7 @@ jobs:
- name: Count lines of code in each file
run: chmod +x ./.github/workflows/countline.py
- name: Running count lines
run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart lib/views/after_auth_screens/org_info_screen.dart
run: ./.github/workflows/countline.py --exclude_directories test/ --exclude_files lib/custom_painters/talawa_logo.dart lib/custom_painters/language_icon.dart lib/custom_painters/whatsapp_logo.dart lib/utils/queries.dart lib/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart lib/view_model/pre_auth_view_models/select_organization_view_model.dart lib/views/after_auth_screens/profile/profile_page.dart lib/view_model/main_screen_view_model.dart lib/views/after_auth_screens/events/create_event_page.dart lib/views/after_auth_screens/org_info_screen.dart lib/views/after_auth_screens/events/manage_volunteer_group.dart
- name: setup python
uses: actions/setup-python@v5
- name: Check for presence of ignore directives corresponding to custom lints
Expand Down Expand Up @@ -92,21 +92,21 @@ jobs:
echo "Error: Source and Target Branches are the same. Please ensure they are different."
exit 1
# - name: Echo the GitHub environment for troubleshooting
# run: echo "$GITHUB_CONTEXT"
# - name: Echo the GitHub context for troubleshooting
# run: echo "${{ toJSON(github) }}"
# - name: setup python
# uses: actions/setup-python@v5
# - name: Granting permission to documentationcheck.py
# run: chmod +x ./.github/workflows/documentationcheck.py
# - name: execute py script
# # For more information on the GitHub context used for the "--repository" flag used by this script visit:
# # https://docs.github.com/en/actions/learn-github-actions/contexts
# run: |
# git branch
# pip install GitPython
# python ./.github/workflows/documentationcheck.py --repository ${{github.repository}} --merge_branch_name ${{github.ref_name}}
# - name: Echo the GitHub environment for troubleshooting
# run: echo "$GITHUB_CONTEXT"
# - name: Echo the GitHub context for troubleshooting
# run: echo "${{ toJSON(github) }}"
# - name: setup python
# uses: actions/setup-python@v5
# - name: Granting permission to documentationcheck.py
# run: chmod +x ./.github/workflows/documentationcheck.py
# - name: execute py script
# # For more information on the GitHub context used for the "--repository" flag used by this script visit:
# # https://docs.github.com/en/actions/learn-github-actions/contexts
# run: |
# git branch
# pip install GitPython
# python ./.github/workflows/documentationcheck.py --repository ${{github.repository}} --merge_branch_name ${{github.ref_name}}

Flutter-Testing:
name: Testing codebase
Expand All @@ -116,12 +116,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '12.0'
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "12.0"
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.3'
channel: 'stable' # or: 'beta', 'dev' or 'master'
flutter-version: "3.22.3"
channel: "stable" # or: 'beta', 'dev' or 'master'
- name: Running pub get to fetch dependencies
run: flutter pub get
- name: Codebase testing
Expand All @@ -132,11 +132,11 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
verbose: true
fail_ci_if_error: false
name: '${{env.CODECOV_UNIQUE_NAME}}'
name: "${{env.CODECOV_UNIQUE_NAME}}"
- name: Test acceptable level of code coverage
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: './coverage/lcov.info'
path: "./coverage/lcov.info"
min_coverage: 92.0

Android-Build:
Expand All @@ -147,12 +147,12 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '12.0'
distribution: "zulu" # See 'Supported distributions' for available options
java-version: "12.0"
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.3'
channel: 'stable' # or: 'beta', 'dev' or 'master'
flutter-version: "3.22.3"
channel: "stable" # or: 'beta', 'dev' or 'master'
- name: Running pub get to fetch dependencies
run: flutter pub get
- name: Building for android
Expand All @@ -166,8 +166,8 @@ jobs:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.22.3'
channel: 'stable' # or: 'beta', 'dev' or 'master'
flutter-version: "3.22.3"
channel: "stable" # or: 'beta', 'dev' or 'master'
architecture: x64
- name: Building for ios
run: flutter build ios --release --no-codesign
Expand Down
6 changes: 6 additions & 0 deletions lib/constants/routing_constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,10 @@ class Routes {

/// static variable to access org info screen.
static const String orgInfoScreen = '/OrganisationInfoScreen';

///static variable to access volunteer groups screen.
static const String volunteerGroupScreen = '/volunteerScreen';

///static variable to access Manage volunteer group screen.
static const String manageVolunteerGroup = '/manageVolunteerScreen';
}
3 changes: 2 additions & 1 deletion lib/locator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import 'package:talawa/view_model/after_auth_view_models/event_view_models/edit_
import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_calendar_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/explore_events_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/manage_volunteer_group_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/feed_view_models/organization_feed_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/profile_view_models/edit_profile_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/profile_view_models/profile_page_view_model.dart';
Expand Down Expand Up @@ -149,7 +150,7 @@ Future<void> setupLocator() async {
locator.registerFactory(() => OrganizationFeedViewModel());
locator.registerFactory(() => SetUrlViewModel());
locator.registerFactory(() => LoginViewModel());

locator.registerFactory(() => ManageVolunteerGroupViewModel());
locator.registerFactory(() => SelectOrganizationViewModel());
locator.registerFactory(() => SignupDetailsViewModel());
locator.registerFactory(() => WaitingViewModel());
Expand Down
72 changes: 72 additions & 0 deletions lib/models/events/event_volunteer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'package:talawa/models/events/event_model.dart';
import 'package:talawa/models/events/event_volunteer_group.dart';
import 'package:talawa/models/user/user_info.dart';

/// This class creates an event volunteer model and returns an EventVolunteer instance.
class EventVolunteer {
EventVolunteer({
this.id,
this.creator,
this.event,
this.group,
this.isAssigned,
this.isInvited,
this.response,
this.user,
});

// Creating a new EventVolunteer instance from a map structure.
factory EventVolunteer.fromJson(Map<String, dynamic> json) {
return EventVolunteer(
id: json['_id'] as String?,
creator: json['creator'] != null
? User.fromJson(
json['creator'] as Map<String, dynamic>,
fromOrg: true,
)
: null,
event: json['event'] != null
? Event.fromJson(json['event'] as Map<String, dynamic>)
: null,
group: json['group'] != null
? EventVolunteerGroup.fromJson(json['group'] as Map<String, dynamic>)
: null,
isAssigned: json['isAssigned'] as bool?,
isInvited: json['isInvited'] as bool?,
response: json['response'] as String?,
user: json['user'] != null
? User.fromJson(json['user'] as Map<String, dynamic>, fromOrg: true)
: null,
);
}

/// Unique identifier for the event volunteer.
String? id;

/// The creation date of the event volunteer.
String? createdAt;

/// The creator of the event volunteer.
User? creator;

/// The event associated with the event volunteer.
Event? event;

/// The group associated with the event volunteer.
EventVolunteerGroup? group;

/// A boolean value that indicates if the volunteer is assigned.
bool? isAssigned;

/// A boolean value that indicates if the volunteer is invited.
bool? isInvited;

/// The response of the volunteer.
String? response;

/// The last update date of the event volunteer.
String? updatedAt;

/// The user who is the volunteer.
User? user;
}
74 changes: 74 additions & 0 deletions lib/models/events/event_volunteer_group.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import 'package:talawa/models/events/event_model.dart';
import 'package:talawa/models/events/event_volunteer.dart';
import 'package:talawa/models/user/user_info.dart';

/// This class creates an event volunteer group model and returns an EventVolunteerGroup instance.
class EventVolunteerGroup {
EventVolunteerGroup({
this.id,
this.createdAt,
this.creator,
this.event,
this.leader,
this.name,
this.updatedAt,
this.volunteers,
this.volunteersRequired,
});

// Creating a new EventVolunteerGroup instance from a map structure.
factory EventVolunteerGroup.fromJson(Map<String, dynamic> json) {
return EventVolunteerGroup(
id: json['_id'] as String?,
createdAt: json['createdAt'] as String?,
creator: json['creator'] == null
? null
: User.fromJson(
json['creator'] as Map<String, dynamic>,
fromOrg: true,
),
event: json['event'] == null
? null
: Event.fromJson(json['event'] as Map<String, dynamic>),
leader: json['leader'] == null
? null
: User.fromJson(
json['leader'] as Map<String, dynamic>,
fromOrg: true,
),
name: json['name'] as String?,
updatedAt: json['updatedAt'] as String?,
volunteers: (json['volunteers'] as List<dynamic>?)
?.map((e) => EventVolunteer.fromJson(e as Map<String, dynamic>))
.toList(),
volunteersRequired: json['volunteersRequired'] as int?,
);
}

/// Unique identifier for the event volunteer group.
String? id;

/// The creation date of the event volunteer group.
String? createdAt;

/// The creator of the event volunteer group.
User? creator;

/// The event associated with the event volunteer group.
Event? event;

/// The leader of the event volunteer group.
User? leader;

/// The name of the event volunteer group.
String? name;

/// The last update date of the event volunteer group.
String? updatedAt;

/// The list of volunteers in the event volunteer group.
List<EventVolunteer>? volunteers;

/// The number of volunteers required for the event volunteer group.
int? volunteersRequired;
}
20 changes: 20 additions & 0 deletions lib/router.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import 'package:flutter/material.dart';
import 'package:talawa/constants/routing_constants.dart';
import 'package:talawa/main.dart';
import 'package:talawa/models/events/event_model.dart';
import 'package:talawa/models/events/event_volunteer_group.dart';
import 'package:talawa/models/mainscreen_navigation_args.dart';
import 'package:talawa/models/organization/org_info.dart';
import 'package:talawa/models/post/post_model.dart';
import 'package:talawa/splash_screen.dart';
import 'package:talawa/view_model/after_auth_view_models/chat_view_models/direct_chat_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/create_event_view_model.dart';
import 'package:talawa/view_model/after_auth_view_models/event_view_models/event_info_view_model.dart';
import 'package:talawa/views/after_auth_screens/add_post_page.dart';
import 'package:talawa/views/after_auth_screens/app_settings/app_settings_page.dart';
import 'package:talawa/views/after_auth_screens/chat/chat_message_screen.dart';
Expand All @@ -19,6 +21,8 @@ import 'package:talawa/views/after_auth_screens/events/edit_event_page.dart';
import 'package:talawa/views/after_auth_screens/events/event_calendar.dart';
import 'package:talawa/views/after_auth_screens/events/event_info_page.dart';
import 'package:talawa/views/after_auth_screens/events/explore_events.dart';
import 'package:talawa/views/after_auth_screens/events/manage_volunteer_group.dart';
import 'package:talawa/views/after_auth_screens/events/volunteer_groups_screen.dart';
import 'package:talawa/views/after_auth_screens/feed/individual_post.dart';
import 'package:talawa/views/after_auth_screens/feed/organization_feed.dart';
import 'package:talawa/views/after_auth_screens/feed/pinned_post_page.dart';
Expand Down Expand Up @@ -310,6 +314,22 @@ Route<dynamic> generateRoute(RouteSettings settings) {
),
);

case Routes.volunteerGroupScreen:
final List<dynamic> arguments = settings.arguments! as List<dynamic>;
final Event event = arguments[0] as Event;
final EventInfoViewModel model = arguments[1] as EventInfoViewModel;
return MaterialPageRoute(
builder: (context) => VolunteerGroupsScreen(event: event, model: model),
);

case Routes.manageVolunteerGroup:
final List<dynamic> arguments = settings.arguments! as List<dynamic>;
final Event event = arguments[0] as Event;
final EventVolunteerGroup group = arguments[1] as EventVolunteerGroup;
return MaterialPageRoute(
builder: (context) => ManageGroupScreen(group: group, event: event),
);

default:
return MaterialPageRoute(
builder: (context) => const DemoPageView(
Expand Down
1 change: 1 addition & 0 deletions lib/services/database_mutation_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class DataBaseMutationFunctions {
final QueryOptions options = QueryOptions(
document: gql(query),
variables: variables ?? <String, dynamic>{},
fetchPolicy: FetchPolicy.networkOnly,
);
final response = await cacheService.executeOrCacheOperation(
operation: query,
Expand Down
Loading

0 comments on commit 37658db

Please sign in to comment.