Skip to content

Commit

Permalink
Merge branch 'develop' into feat/new-restaurants-api
Browse files Browse the repository at this point in the history
  • Loading branch information
HenriqueSFernandes authored Jan 2, 2025
2 parents 2ecb3f8 + d6df6ef commit e17b8d1
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion packages/uni_app/app_version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.10.0-beta.50+355
1.10.0-beta.51+356
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import 'package:html/parser.dart';
import 'package:http/http.dart';
import 'package:uni/controller/fetchers/session_dependant_fetcher.dart';
import 'package:uni/controller/networking/network_router.dart';
import 'package:uni/controller/parsers/parser_course_unit_info.dart';
import 'package:uni/model/entities/course_units/course_unit_class.dart';
import 'package:uni/model/entities/course_units/course_unit_directory.dart';
import 'package:uni/model/entities/course_units/course_unit_sheet.dart';
import 'package:uni/model/entities/course_units/sheet.dart';
import 'package:uni/session/flows/base/session.dart';

Expand All @@ -14,31 +14,39 @@ class CourseUnitsInfoFetcher implements SessionDependantFetcher {
return NetworkRouter.getBaseUrlsFromSession(session).toList();
}

Future<CourseUnitSheet> fetchCourseUnitSheet(
Session session,
int occurrId,
) async {
// if course unit is not from the main faculty, Sigarra redirects
final url = '${getEndpoints(session)[0]}ucurr_geral.ficha_uc_view';
final response = await NetworkRouter.getWithCookies(
url,
{'pv_ocorrencia_id': occurrId.toString()},
session,
);
return parseCourseUnitSheet(response);
}

Future<Sheet> fetchSheet(
Session session,
int occurId,
) async {
final url = '${getEndpoints(session)[0]}mob_ucurr_geral.perfil';
final response = await NetworkRouter.getWithCookies(
url,
{'pv_ocorrencia_id': occurId.toString()},
session,
final responses = await Future.wait(
getEndpoints(session)
.map((endpoint) => '$endpoint' 'mob_ucurr_geral.perfil')
.map(
(url) => NetworkRouter.getWithCookies(
url,
{'pv_ocorrencia_id': occurId.toString()},
session,
).catchError((_) => Response('', 500)),
),
);
return parseSheet(response);

final bestResponse = responses
.where((response) => response.statusCode == 200)
.fold<Response?>(
null,
(best, current) =>
current.body.length > (best?.body.length ?? 0) ? current : best,
);

return bestResponse != null
? parseSheet(bestResponse)
: Sheet(
professors: [],
regents: [],
content: '',
evaluation: '',
books: [],
);
}

Future<List<CourseUnitFileDirectory>> fetchCourseUnitFiles(
Expand Down
2 changes: 1 addition & 1 deletion packages/uni_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish_to: "none" # We do not publish to pub.dev
# To change it manually, override the value in app_version.txt.
# The app version code is automatically also bumped by CI.
# Do not change it manually.
version: 1.10.0-beta.50+355
version: 1.10.0-beta.51+356

environment:
sdk: ">=3.4.0 <4.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/uni_ui/lib/timeline/timeline.dart
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class _TimelineState extends State<Timeline> {
child: ScrollablePositionedList.builder(
itemCount: widget.content.length,
itemScrollController: _itemScrollController,
itemPositionsListener: _itemPositionsListener,
itemPositionsListener: _itemPositionsListener,
itemBuilder: (context, index) {
return widget.content[index];
},
Expand Down

0 comments on commit e17b8d1

Please sign in to comment.