Skip to content

Commit

Permalink
Refactoring SJM part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
SiekamCebule committed Nov 17, 2024
1 parent 2405556 commit 560853c
Show file tree
Hide file tree
Showing 346 changed files with 2,328 additions and 1,811 deletions.
File renamed without changes.
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import 'package:sj_manager/utilities/json/json_types.dart';
part 'simple_jump.g.dart';

@JsonSerializable()
class SimpleJump with EquatableMixin {
const SimpleJump({
class SimpleJumpModel with EquatableMixin {
const SimpleJumpModel({
required this.jumperNameAndSurname,
required this.distance,
});

final String jumperNameAndSurname;
final double distance;

static SimpleJump fromJson(Json json) => _$SimpleJumpFromJson(json);
static SimpleJumpModel fromJson(Json json) => _$SimpleJumpFromJson(json);

Json toJson() => _$SimpleJumpToJson(this);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:sj_manager/data/models/database/psyche/level_of_consciousness.dart';
import 'package:sj_manager/domain/entities/simulation/psyche/level_of_consciousness.dart';

enum Personalities {
compromised, // Wstyd, Skompromitowany
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:sj_manager/data/models/database/country/country.dart';
import 'package:sj_manager/data/models/database/sex.dart';
import 'package:sj_manager/data/models/database/team/country_team/country_team_facts.dart';
import 'package:sj_manager/data/models/database/team/team.dart';
import 'package:sj_manager/core/country/country.dart';
import 'package:sj_manager/features/game_variants/data/models/game_variant_database.dart/sex.dart';
import 'package:sj_manager/core/team/country_team/country_team_facts_model.dart';
import 'package:sj_manager/domain/entities/simulation/team/team.dart';

class CountryTeam extends Team {
const CountryTeam({
Expand All @@ -12,7 +12,7 @@ class CountryTeam extends Team {

final Sex sex;
final Country country;
final CountryTeamFacts facts;
final CountryTeamFactsModel facts;

@override
List<Object?> get props => [
Expand All @@ -24,7 +24,7 @@ class CountryTeam extends Team {
CountryTeam copyWith({
Sex? sex,
Country? country,
CountryTeamFacts? facts,
CountryTeamFactsModel? facts,
}) {
return CountryTeam(
sex: sex ?? this.sex,
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:sj_manager/utilities/json/json_types.dart';
import 'package:sj_manager/data/models/database/jumps/simple_jump.dart';
import 'package:sj_manager/data/models/database/team/country_team/subteam_type.dart';
import 'package:sj_manager/core/jumps/simple_jump_model.dart';
import 'package:sj_manager/domain/entities/simulation/team/subteam_type.dart';

part 'country_team_facts.g.dart';

@JsonSerializable()
class CountryTeamFacts with EquatableMixin {
const CountryTeamFacts({
class CountryTeamFactsModel with EquatableMixin {
const CountryTeamFactsModel({
required this.stars,
this.record,
required this.subteams,
required this.limitInSubteam,
});

const CountryTeamFacts.empty()
const CountryTeamFactsModel.empty()
: this(
stars: 0,
record: null,
Expand All @@ -24,11 +24,11 @@ class CountryTeamFacts with EquatableMixin {
);

final int stars;
final SimpleJump? record;
final SimpleJumpModel? record;
final Set<SubteamType> subteams;
final Map<SubteamType, int> limitInSubteam;

static CountryTeamFacts fromJson(Json json) => _$CountryTeamFactsFromJson(json);
static CountryTeamFactsModel fromJson(Json json) => _$CountryTeamFactsFromJson(json);

Json toJson() => _$CountryTeamFactsToJson(this);

Expand Down
24 changes: 0 additions & 24 deletions lib/data/models/database/jumper/landing_style.dart

This file was deleted.

43 changes: 0 additions & 43 deletions lib/data/models/database/user_algorithms_repo.dart

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:io';

import 'package:sj_manager/utilities/json/db_items_json.dart';
import 'package:sj_manager/utilities/json/json_types.dart';
import 'package:sj_manager/data/models/database/db_items_file_system_paths.dart';
import 'package:sj_manager/data/repositories/db_items_file_system_paths.dart';
import 'package:sj_manager/utilities/utils/file_system.dart';
import 'package:path/path.dart' as path;

Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions lib/data/models/running/competition_flow_controller.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:sj_manager/data/models/running/competition_start_list_repository.dart';
import 'package:sj_manager/data/models/simulation/competition/rules/competition_rules/default_competition_rules.dart';
import 'package:sj_manager/data/models/database/jumper/jumper_db_record.dart';
import 'package:sj_manager/data/models/database/team/team.dart';
import 'package:sj_manager/domain/entities/simulation/competition/rules/competition_rules/default_competition_rules.dart';
import 'package:sj_manager/features/game_variants/domain/entities/jumper/jumper_db_record.dart';
import 'package:sj_manager/domain/entities/simulation/team/team.dart';

abstract class CompetitionFlowController<E> {
CompetitionFlowController({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:sj_manager/data/models/running/competition_flow_controller.dart';
import 'package:sj_manager/data/models/simulation/competition/rules/competition_round_rules/default_team_competition_round_rules.dart';
import 'package:sj_manager/domain/entities/simulation/competition/rules/competition_round_rules/default_team_competition_round_rules.dart';

class DefaultIndividualCompetitionFlowController
extends IndividualCompetitionFlowController {
Expand Down

This file was deleted.

18 changes: 0 additions & 18 deletions lib/data/models/simulation/standings/score/typedefs.dart

This file was deleted.

2 changes: 1 addition & 1 deletion lib/data/models/training_analyzer/training_segment.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:sj_manager/data/models/simulation/flow/training/jumper_training_config.dart';
import 'package:sj_manager/domain/entities/simulation/flow/training/jumper_training_config.dart';

class TrainingSegment {
const TrainingSegment({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
import 'package:sj_manager/utilities/json/json_types.dart';
import 'package:sj_manager/data/models/simulation/flow/simulation_mode.dart';
import 'package:sj_manager/data/models/simulation/database/simulation_database_and_models/simulation_database.dart';
import 'package:sj_manager/domain/entities/simulation/flow/simulation_mode.dart';
import 'package:sj_manager/domain/entities/simulation/database/simulation_database_and_models/simulation_database.dart';

class UserSimulationModel {
const UserSimulationModel({
class SimulationModel {
const SimulationModel({
required this.id,
required this.name,
required this.saveTime,
required this.mode,
required this.subteamCountryFlagPath,
required this.subteamCountryFlagName,
});

final String id;
final String name;
final DateTime saveTime;
final SimulationMode mode;
final String? subteamCountryFlagPath;
final String? subteamCountryFlagName;

Json toJson() {
return {
'id': id,
'name': name,
'saveTime': saveTime.toIso8601String(),
'subteamCountryFlagPath': subteamCountryFlagPath,
'subteamCountryFlagPath': subteamCountryFlagName,
'mode': mode.name,
};
}

factory UserSimulationModel.fromJson(Map<String, dynamic> json) {
return UserSimulationModel(
factory SimulationModel.fromJson(Map<String, dynamic> json) {
return SimulationModel(
id: json['id'] as String,
name: json['name'] as String,
saveTime: DateTime.parse(json['saveTime'] as String),
mode: SimulationMode.values.singleWhere((mode) => mode.name == json['mode']),
subteamCountryFlagPath: json['subteamCountryFlagPath'],
subteamCountryFlagName: json['subteamCountryFlagPath'],
);
}

UserSimulationModel copyWith({
SimulationModel copyWith({
String? id,
String? name,
DateTime? saveTime,
SimulationMode? mode,
String? subteamCountryFlagPath,
SimulationDatabase? database,
}) {
return UserSimulationModel(
return SimulationModel(
id: id ?? this.id,
name: name ?? this.name,
saveTime: saveTime ?? this.saveTime,
mode: mode ?? this.mode,
subteamCountryFlagPath: subteamCountryFlagPath ?? this.subteamCountryFlagPath,
subteamCountryFlagName: subteamCountryFlagPath ?? this.subteamCountryFlagName,
);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:sj_manager/utilities/json/db_items_json.dart';
import 'package:sj_manager/data/models/simulation/user_simulation/user_simulation_model.dart';
import 'package:sj_manager/data/models/user_simulation/simulation_model.dart';
import 'package:sj_manager/utilities/utils/file_system.dart';
import 'package:path/path.dart' as path;

Expand All @@ -9,7 +9,7 @@ class UserSimulationsRegistrySaverToFile {
required this.pathsCache,
});

final List<UserSimulationModel> userSimulations;
final List<SimulationModel> userSimulations;
final PlarformSpecificPathsCache pathsCache;

Future<void> serialize() async {
Expand Down
Loading

0 comments on commit 560853c

Please sign in to comment.