Skip to content

Commit

Permalink
Merge pull request #1 from maheini/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
maheini authored Apr 7, 2022
2 parents d2da73b + 3c5ef2e commit 0a9f8df
Show file tree
Hide file tree
Showing 35 changed files with 2,266 additions and 302 deletions.
25 changes: 22 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@

# Racego

A cross-platform race-management tool.
A cross-platform race-management tool for Desktop and web.
<p align="center">
<img src="https://user-images.githubusercontent.com/65506676/162324108-207cc035-1e04-45c3-9d93-313787e18d29.png">
</p>
<p align="center">Home screen with dark an light theme: quick access to user-management and ranking list</p>

## Languages

English and German languages are supported.

## Supported Platforms

Expand All @@ -18,8 +26,19 @@ Every idea is welcome. Feel free to contribute via pull request or opening a iss

## Some backgrounds about Racego

Racego was first released as a native Windows application in 2020. Later on, Neofix further increased the capabilities and refactored everythin up to a new release in 2021. Racego did served well on it's first tests and as it grows in popularity, Neofix decided to bring Racego to cross-platform with further possibilities of extensions.
Racego was first released as a native Windows application in 2020. Later on, Neofix further increased the capabilities and refactored everything up to a new release in 2021. Racego did served well on it's first tests and as it grows in popularity, Neofix decided to bring Racego to cross-platform with further possibilities of extensions.

## License & copyright

Licensed under the [GPLv3 License](LICENSE).

## Screenshots

<p align="center">Edit profile of every participant</p>
<p align="center">
<img src="https://user-images.githubusercontent.com/65506676/162325732-c28291fd-01e4-476f-a1ca-7390f989ca38.png">
</p>

<p align="center">
<img src="https://user-images.githubusercontent.com/65506676/162321999-5379aad1-7b96-496b-863c-c12323403bb7.jpg">
</p>
5 changes: 3 additions & 2 deletions lib/business_logic/login/login_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';
import 'package:racego/data/api/racego_api.dart';
import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:racego/generated/l10n.dart';

part 'login_event.dart';
part 'login_state.dart';
Expand All @@ -24,7 +25,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
emit(LoggedOut());
}
} on RacegoException catch (_) {
emit(LoginError('Melden Sie sich erneut an'));
emit(LoginError(S.current.retry_login));
}
}

Expand All @@ -35,7 +36,7 @@ class LoginBloc extends Bloc<LoginEvent, LoginState> {
if (isLoggedIn) {
emit(LoggedIn(username: _api.username));
} else {
emit(LoginError('Email oder Passwort ist ungültig'));
emit(LoginError(S.current.login_invalid));
}
} on RacegoException catch (racegoException) {
emit(LoginError(racegoException.errorMessage));
Expand Down
60 changes: 60 additions & 0 deletions lib/business_logic/ranking_cubit/ranking_cubit.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import 'package:bloc/bloc.dart';
import 'package:meta/meta.dart';
import 'package:racego/data/models/rankinglist.dart';

import '../../data/api/racego_api.dart';
import '../../data/exceptions/racego_exception.dart';
import '../../generated/l10n.dart';

part 'rankingcubit_state.dart';

class RankingCubit extends Cubit<RankingcubitState> {
RankingCubit(RacegoApi api)
: _api = api,
super(const RankingLoading(currentClass: '', classList: [])) {
loadClasses();
}
final RacegoApi _api;

List<String> _classes = [];
String _currentClass = '';
RankingList _currentRanking = RankingList(null);

Future<void> loadClasses() async {
try {
_classes = await _api.getCategories();
// if (!_classes.contains(_currentClass)) {
// _currentClass = '';
// _classes.clear();
// }
emit(RankingLoaded(_currentRanking,
currentClass: _currentClass, classList: _classes));
} catch (e) {
if (e is RacegoException) {
emit(RankingError(e, currentClass: _currentClass, classList: _classes));
} else {
UnknownException error = UnknownException(
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(RankingError(error,
currentClass: _currentClass, classList: _classes));
}
}
}

Future<void> loadRanking(String? raceClass) async {
try {
_currentRanking = await _api.getRankig(raceClass);
emit(RankingLoaded(_currentRanking,
currentClass: _currentClass, classList: _classes));
} catch (e) {
if (e is RacegoException) {
emit(RankingError(e, currentClass: _currentClass, classList: _classes));
} else {
UnknownException error = UnknownException(
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(RankingError(error,
currentClass: _currentClass, classList: _classes));
}
}
}
}
29 changes: 29 additions & 0 deletions lib/business_logic/ranking_cubit/rankingcubit_state.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
part of 'ranking_cubit.dart';

@immutable
abstract class RankingcubitState {
const RankingcubitState(
{required this.currentClass, required this.classList});
final String currentClass;
final List<String> classList;
}

class RankingLoading extends RankingcubitState {
const RankingLoading(
{required String currentClass, required List<String> classList})
: super(currentClass: currentClass, classList: classList);
}

class RankingLoaded extends RankingcubitState {
const RankingLoaded(this.ranking,
{required String currentClass, required List<String> classList})
: super(currentClass: currentClass, classList: classList);
final RankingList ranking;
}

class RankingError extends RankingcubitState {
const RankingError(this.exception,
{required String currentClass, required List<String> classList})
: super(currentClass: currentClass, classList: classList);
final RacegoException exception;
}
14 changes: 7 additions & 7 deletions lib/business_logic/tracklist_cubit/tracklist_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:racego/data/models/time.dart';
import 'package:racego/data/models/user.dart';

import '../../generated/l10n.dart';

part 'tracklist_state.dart';

class TracklistCubit extends Cubit<TracklistState> {
Expand Down Expand Up @@ -52,7 +54,7 @@ class TracklistCubit extends Cubit<TracklistState> {
));
} else {
UnknownException error = UnknownException(
'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty ? _filterList(_newestList, _filter) : _newestList,
Expand Down Expand Up @@ -81,8 +83,7 @@ class TracklistCubit extends Cubit<TracklistState> {
try {
bool successful = await _api.cancelLap(userId);
if (!successful) {
throw DataException(
'Benutzer konnte nicht von der Rennstrecke entfernt werden: Id ungültig.');
throw DataException(S.current.failed_cancelling_lap_invalid_id);
}
reload();
} catch (e) {
Expand All @@ -94,7 +95,7 @@ class TracklistCubit extends Cubit<TracklistState> {
: _newestList));
} else {
UnknownException error = UnknownException(
'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
Expand All @@ -110,8 +111,7 @@ class TracklistCubit extends Cubit<TracklistState> {
try {
bool successful = await _api.finishLap(userId, time);
if (!successful) {
throw DataException(
'Rundenzeit konnte nicht erfasst werden: Id oder Zeit ungültig.');
throw DataException(S.current.failed_finishing_lap_invalid_id);
}
reload();
} catch (e) {
Expand All @@ -123,7 +123,7 @@ class TracklistCubit extends Cubit<TracklistState> {
: _newestList));
} else {
UnknownException error = UnknownException(
'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
Expand Down
11 changes: 0 additions & 11 deletions lib/business_logic/tracklist_cubit/tracklist_state.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
// part of 'tracklist_cubit.dart';

// @immutable
// abstract class TracklistState {}

// class Loading extends TracklistState {}

// class Loaded extends TracklistState {}

// class Error extends TracklistState {}

part of 'tracklist_cubit.dart';

@immutable
Expand Down
14 changes: 7 additions & 7 deletions lib/business_logic/userlist_cubit/userlist_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:racego/data/api/racego_api.dart';
import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:racego/data/models/user.dart';

import '../../generated/l10n.dart';

part 'userlist_state.dart';

class UserlistCubit extends Cubit<UserlistState> {
Expand Down Expand Up @@ -51,7 +53,7 @@ class UserlistCubit extends Cubit<UserlistState> {
));
} else {
UnknownException error = UnknownException(
'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty ? _filterList(_newestList, _filter) : _newestList,
Expand All @@ -67,8 +69,7 @@ class UserlistCubit extends Cubit<UserlistState> {
try {
bool successful = await _api.deleteUser(userId);
if (!successful) {
throw DataException(
'Benutzer konnte nicht entfernt werden: Id ungültig.');
throw DataException(S.current.failed_removing_user_invalid_id);
}
reload();
} catch (e) {
Expand All @@ -80,7 +81,7 @@ class UserlistCubit extends Cubit<UserlistState> {
: _newestList));
} else {
UnknownException error = UnknownException(
'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
Expand All @@ -96,8 +97,7 @@ class UserlistCubit extends Cubit<UserlistState> {
try {
bool successful = await _api.addOnTrack(userId);
if (!successful) {
throw DataException(
'Benutzer konnte nicht auf die Rennstrecke gestellt werden: Id ungültig.');
throw DataException(S.current.failed_adding_user_on_track_invalid_id);
}
reload();
} catch (e) {
Expand All @@ -109,7 +109,7 @@ class UserlistCubit extends Cubit<UserlistState> {
: _newestList));
} else {
UnknownException error = UnknownException(
'Unbekannter Fehler', e.toString(), e.runtimeType.toString());
S.current.unknown_error, e.toString(), e.runtimeType.toString());
emit(Error(
error,
_filter.isNotEmpty
Expand Down
19 changes: 10 additions & 9 deletions lib/business_logic/userscreen_cubit/userscreen_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:racego/data/api/racego_api.dart';
import 'package:racego/data/exceptions/racego_exception.dart';
import 'package:racego/data/models/userdetails.dart';

import '../../generated/l10n.dart';

part 'userscreen_state.dart';

class UserscreenCubit extends Cubit<UserscreenState> {
Expand All @@ -27,14 +29,13 @@ class UserscreenCubit extends Cubit<UserscreenState> {
if (id > 0) {
loadEditUser(id);
} else {
throw UnknownException(
'Benutzer konnte nicht erstellt werden: Datenbank Id ist ungültig');
throw UnknownException(S.current.failed_adding_user_invalid_id);
}
} on RacegoException catch (e) {
emit(UserScreenAddError(e));
} catch (error) {
UnknownException e = UnknownException(
'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
UnknownException e = UnknownException(S.current.unknown_error,
error.toString(), error.runtimeType.toString());
emit(UserScreenAddError(e));
}
}
Expand All @@ -51,8 +52,8 @@ class UserscreenCubit extends Cubit<UserscreenState> {
} on RacegoException catch (e) {
emit(UserScreenEditError(e));
} catch (error) {
UnknownException e = UnknownException(
'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
UnknownException e = UnknownException(S.current.unknown_error,
error.toString(), error.runtimeType.toString());
emit(UserScreenEditError(e));
}
}
Expand All @@ -68,13 +69,13 @@ class UserscreenCubit extends Cubit<UserscreenState> {
emit(UserScreenStored());
} else {
throw UnknownException(
'Benutzer konnte nicht aktualisiert werden: Unerwartete Serverantwort');
S.current.failed_updating_user_unexpected_response);
}
} on RacegoException catch (e) {
emit(UserScreenEditError(e));
} catch (error) {
UnknownException e = UnknownException(
'Unbekannter Fehler', error.toString(), error.runtimeType.toString());
UnknownException e = UnknownException(S.current.unknown_error,
error.toString(), error.runtimeType.toString());
emit(UserScreenEditError(e));
}
}
Expand Down
Loading

0 comments on commit 0a9f8df

Please sign in to comment.