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

Byl8/challenge bug fix #199

Merged
merged 9 commits into from
Apr 21, 2024
10 changes: 5 additions & 5 deletions game/lib/challenges/challenges_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:game/model/event_model.dart';
import 'package:game/model/group_model.dart';
import 'package:game/model/tracker_model.dart';
import 'package:game/model/user_model.dart';
import 'package:game/utils/utility_functions.dart';
import 'package:provider/provider.dart';
import 'challenge_cell.dart';
import 'package:game/journeys/filter_form.dart';
Expand Down Expand Up @@ -131,7 +132,6 @@ class _ChallengesPageState extends State<ChallengesPage> {
if (curEvent != null) events.add(curEvent);
}
for (EventDto event in events) {
print(event);
var tracker = trackerModel.trackerByEventId(event.id);
var numberCompleted = tracker?.prevChallenges?.length ?? 0;
var complete =
Expand Down Expand Up @@ -163,13 +163,13 @@ class _ChallengesPageState extends State<ChallengesPage> {
)
: ChallengeCell(
key: UniqueKey(),
challenge.location?.name ?? "",
challenge.name ?? "",
friendlyLocation[challenge.location] ?? "",
event.name ?? "",
Image.network(
"https://picsum.photos/250?image=9"),
complete,
challenge.description ?? "",
event.difficulty?.name ?? "",
event.description ?? "",
friendlyDifficulty[event.difficulty] ?? "",
challenge.points ?? 0,
event.id),
),
Expand Down
12 changes: 1 addition & 11 deletions game/lib/gameplay/gameplay_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:game/model/tracker_model.dart';
import 'package:game/model/group_model.dart';
import 'package:game/api/geopoint.dart';
import 'package:game/navigation_page/home_navbar.dart';
import 'package:game/utils/utility_functions.dart';
import 'package:geolocator/geolocator.dart';
import 'package:game/model/challenge_model.dart';
import 'gameplay_map.dart';
Expand Down Expand Up @@ -41,17 +42,6 @@ class _GameplayPageState extends State<GameplayPage> {

late StreamSubscription<Position> positionStream;

final Map<String, String> friendlyLocation = {
"ENG_QUAD": "Eng Quad",
"ARTS_QUAD": "Arts Quad",
"AG_QUAD": "Ag Quad",
"NORTH_CAMPUS": "North Campus",
"WEST_CAMPUS": "West Campus",
"COLLEGETOWN": "Collegetown",
"ITHACA_COMMONS": "Ithaca Commons",
"ANY": "Cornell",
};

@override
void initState() {
startPositionStream();
Expand Down
9 changes: 5 additions & 4 deletions game/lib/journeys/journeys_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:game/model/group_model.dart';
import 'package:game/model/tracker_model.dart';
import 'package:game/model/challenge_model.dart';
import 'package:game/model/user_model.dart';
import 'package:game/utils/utility_functions.dart';
import 'package:provider/provider.dart';

class JourneysPage extends StatefulWidget {
Expand Down Expand Up @@ -177,16 +178,16 @@ class _JourneysPageState extends State<JourneysPage> {
: JourneyCell(
key: UniqueKey(),
event.name ?? "",
location?.name ?? "",
friendlyLocation[location] ?? "",
Image.network(
"https://picsum.photos/250?image=9"), // dummy data for now; should pass in thumbnail parameter
event.description ?? "",
locationCount,
numberCompleted,
complete,
difficulty?.name ?? "",
totalPoints,
event.id),
friendlyDifficulty[difficulty] ?? "",
totalPoints, event.id,
),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion game/lib/profile/completed_challenges_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class CompletedChallengesPage extends StatelessWidget {
type: type,
date: DateFormat("MMMM d, y").format(date),
location: locationList[0],
difficulty: difficultyToString[event.difficulty]!,
difficulty: friendlyDifficulty[event.difficulty]!,
points: totalPoints,
);
},
Expand Down
2 changes: 1 addition & 1 deletion game/lib/profile/profile_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class _ProfilePageState extends State<ProfilePage> {
locationImage,
type,
formattedDate,
difficultyToString[event.difficulty]!,
friendlyDifficulty[event.difficulty]!,
totalPoints);
},
physics: BouncingScrollPhysics(),
Expand Down
13 changes: 12 additions & 1 deletion game/lib/utils/utility_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,19 @@ Text LatoText(String text, double fs, Color color, FontWeight fw) {
color: color, fontWeight: FontWeight.bold, fontSize: fs)));
}

final Map<EventDifficultyDto, String> difficultyToString = {
final Map<EventDifficultyDto, String> friendlyDifficulty = {
EventDifficultyDto.Easy: "Easy",
EventDifficultyDto.Normal: "Normal",
EventDifficultyDto.Hard: "Hard",
};

final Map<String, String> friendlyLocation = {
"ENG_QUAD": "Eng Quad",
"ARTS_QUAD": "Arts Quad",
"AG_QUAD": "Ag Quad",
"NORTH_CAMPUS": "North Campus",
"WEST_CAMPUS": "West Campus",
"COLLEGETOWN": "Collegetown",
"ITHACA_COMMONS": "Ithaca Commons",
"ANY": "Cornell",
};
Loading