Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Lib_CSharp
Submodule Lib_CSharp updated 64 files
+14 −0 .gitignore
+8 −0 PoliNetwork.Core/src/Enums/CacheTypeEnum.cs
+9 −0 PoliNetwork.Core/src/Enums/DoneEnum.cs
+35 −0 PoliNetwork.Core/src/Objects/Threading/ThreadWithAction.cs
+4 −0 PoliNetwork.Core/src/PoliNetwork.Core.csproj
+1 −1 PoliNetwork.Core/src/Utils/LoggerNS/LogConfig.cs
+6 −6 PoliNetwork.Core/src/Utils/LoggerNS/LogLevel.cs
+1 −1 PoliNetwork.Core/src/Utils/LoggerNS/Logger.cs
+1 −0 PoliNetwork.Db/src/Variables/Variables.cs
+5 −0 PoliNetwork.Html/Class1.cs
+31 −0 PoliNetwork.Html/Objects/Web/WebReply.cs
+24 −0 PoliNetwork.Html/PoliNetwork.Html.csproj
+67 −0 PoliNetwork.Html/Utils/HtmlUtil.cs
+129 −0 PoliNetwork.Html/Utils/NodeFilterUtil.cs
+41 −0 PoliNetwork.Html/Utils/NodeUtil.cs
+5 −0 PoliNetwork.Rooms/Class1.cs
+8 −0 PoliNetwork.Rooms/Enums/RoomOccupancyEnum.cs
+22 −0 PoliNetwork.Rooms/Objects/RoomOccupancyResultObject.cs
+22 −0 PoliNetwork.Rooms/PoliNetwork.Rooms.csproj
+63 −0 PoliNetwork.Rooms/Utils/ExtractHtmlRoomUtil.cs
+130 −0 PoliNetwork.Rooms/Utils/FreeRoomsUtil.cs
+59 −0 PoliNetwork.Rooms/Utils/RoomUtil.cs
+23 −0 PoliNetwork.Rooms/Utils/Search/SearchUtil.cs
+86 −0 PoliNetwork.Rooms/Utils/SingleRoomUtil.cs
+61 −0 PoliNetwork.Telegram/src/Bot/Bots/AbstractTelegramBot.cs
+44 −0 PoliNetwork.Telegram/src/Bot/Bots/ModerationBot.cs
+35 −0 PoliNetwork.Telegram/src/Bot/Bots/TestBot.cs
+9 −0 PoliNetwork.Telegram/src/Bot/Functionality/IEcho.cs
+6 −0 PoliNetwork.Telegram/src/Configuration/Configuration.cs
+0 −16 PoliNetwork.Telegram/src/Objects/Bot/ITelegramBotWrapper.cs
+0 −142 PoliNetwork.Telegram/src/Objects/Bot/TelegramBot.cs
+0 −59 PoliNetwork.Telegram/src/Objects/Bot/TestBot.cs
+0 −14 PoliNetwork.Telegram/src/Objects/Configuration/TelegramConfiguration.cs
+0 −23 PoliNetwork.Telegram/src/Objects/Configuration/UpdateMethod.cs
+0 −42 PoliNetwork.Telegram/src/Objects/Updates/Chat/ChatFromBot.cs
+0 −15 PoliNetwork.Telegram/src/Objects/Updates/Chat/IChat.cs
+0 −15 PoliNetwork.Telegram/src/Objects/Updates/Message/IMessage.cs
+0 −22 PoliNetwork.Telegram/src/Objects/Updates/Message/MessageFromBot.cs
+0 −12 PoliNetwork.Telegram/src/Objects/Updates/Update/IUpdate.cs
+0 −19 PoliNetwork.Telegram/src/Objects/Updates/Update/UpdateFromBot.cs
+0 −24 PoliNetwork.Telegram/src/Objects/Updates/User/UserFromBot.cs
+9 −0 PoliNetwork.Telegram/src/Options/AbstractTelegramBotOptions.cs
+7 −0 PoliNetwork.Telegram/src/Options/TelegramBotOptions.cs
+16 −0 PoliNetwork.Telegram/src/Options/UpdateMethod.cs
+31 −0 PoliNetwork.Telegram/src/Properties/BotChat.cs
+20 −0 PoliNetwork.Telegram/src/Properties/BotMessage.cs
+10 −0 PoliNetwork.Telegram/src/Properties/BotUpdate.cs
+18 −0 PoliNetwork.Telegram/src/Properties/BotUser.cs
+1 −1 PoliNetwork.Telegram/src/Properties/ChatType.cs
+9 −0 PoliNetwork.Telegram/src/Properties/IChat.cs
+8 −0 PoliNetwork.Telegram/src/Properties/IMessage.cs
+6 −0 PoliNetwork.Telegram/src/Properties/IUpdate.cs
+3 −2 PoliNetwork.Telegram/src/Properties/IUser.cs
+48 −0 PoliNetwork.Telegram/src/Utility/ConfigurationLoader/FileConfigurationLoader.cs
+19 −0 PoliNetwork.Telegram/src/Utility/ConfigurationLoader/JSONFileConfigurationLoader.cs
+8 −0 PoliNetwork.Telegram/src/Utility/ConfigurationLoader/TelegramConfigurationUtility.cs
+111 −0 PoliNetwork.Telegram/src/Utility/Logger/AbstractLogger.cs
+22 −0 PoliNetwork.Telegram/src/Utility/Logger/DefaultLogger.cs
+0 −38 PoliNetwork.Telegram/src/Utils/ConfigUtils/TelegramConfiguration.cs
+0 −40 PoliNetwork.Telegram/src/Utils/Echo.cs
+0 −6 PoliNetwork.Telegram/src/Variables/Variables.cs
+26 −8 PoliNetworkLibraries.sln
+9 −4 docs/dipendenze/schema.plantuml
+ docs/dipendenze/schema.png
2 changes: 1 addition & 1 deletion PoliNetwork.Graduatorie.Common/Utils/EnrollUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace PoliNetwork.Graduatorie.Common.Utils;

public class EnrollUtil
public static class EnrollUtil
{
public static EnrollType GetEnrollType(string? rowCanEnrollInto, bool rowCanEnroll)
{
Expand Down
12 changes: 8 additions & 4 deletions PoliNetwork.Graduatorie.Parser/Objects/Json/DateFound.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ public void WriteToFile(string dataFolder)

public static DateTime? MinDateTime(DateTime? date1, DateTime? date2)
{
if (date1 == null && date2 == null)
return null;
if (date1 == null)
return date2;
switch (date1)
{
case null when date2 == null:
return null;
case null:
return date2;
}

if (date2 == null)
return date1;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ private static void AddToRankings(ICollection<Ranking> rankings, Ranking ranking
&& x.Year == ranking.Year
&& Similar(x.ByCourse, ranking.ByCourse)
);
if (!any)

if (!any)
rankings.Add(ranking);
}

Expand All @@ -281,9 +281,15 @@ private static bool Similar(
if (a == null || b == null)
return false;
return a.Count == b.Count && a.Select(Selector).All(Predicate);

bool Selector(CourseTable variable) => b.Any(x => x.Title == variable.Title);
bool Predicate(bool boolB) => boolB;


bool Selector(CourseTable variable)
{
return b.Any(x => x.Title == variable.Title);
}

bool Predicate(bool boolB)
{
return boolB;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ public class SingleCourseJson
public string? Link;
public string? Location;
public string? Name;
public RankingOrder? RankingOrder;
public SchoolEnum? School;
public int? Year;
public RankingOrder? RankingOrder;

public int GetHashWithoutLastUpdate()
{
Expand Down Expand Up @@ -59,4 +59,4 @@ public bool Is(CourseTable courseTable)
{
return Name == courseTable.Title;
}
}
}
4 changes: 2 additions & 2 deletions PoliNetwork.Graduatorie.Parser/Objects/RankingNS/Ranking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public List<SingleCourseJson> ToSingleCourseJson()
Year = Year,
School = School,
Location = variable.Location,
RankingOrder = RankingOrder,
RankingOrder = RankingOrder
}));

return result;
Expand All @@ -137,4 +137,4 @@ public string GetPath()
{
return School + "/" + Year + "/" + RankingOrder?.Phase;
}
}
}
2 changes: 1 addition & 1 deletion PoliNetwork.Graduatorie.Parser/Utils/Hashing.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace PoliNetwork.Graduatorie.Parser.Utils;

public class Hashing
public static class Hashing
{
public static int? GetHashFromListHash(IReadOnlyCollection<int?>? iMerit)
{
Expand Down
11 changes: 11 additions & 0 deletions PoliNetwork.Graduatorie.Parser/Utils/Output/HashMatricoleWrite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,20 @@ public static void Write(RankingsSet? rankingsSet, string outFolder)
return;

var dictionary = GetDictToWrite(rankingsSet);
Sort2(dictionary);
WriteToFile(dictionary, outFolder);
}

private static void Sort2(SortedDictionary<string, StudentHashSummary> dict)
{
var keys = dict.Keys;
foreach (var key in keys)
{
var item = dict[key];
item.Sort2();
}
}

private static SortedDictionary<string, StudentHashSummary> GetDictToWrite(RankingsSet rankingsSet)
{
var dictionary = new SortedDictionary<string, StudentHashSummary>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,27 @@ public RankingSummaryStudent(string? phase, SchoolEnum? school, int? year, Ranki
Url = url;
}

public int Compare(RankingSummaryStudent o)
{
var i = (Year ?? 0) - (o.Year ?? 0);
if (i != 0) return i < 0 ? -1 : 1;

i = string.CompareOrdinal(Course ?? "", o.Course ?? "");
if (i != 0) return i < 0 ? -1 : 1;

i = string.CompareOrdinal(Phase ?? "", o.Phase ?? "");
if (i != 0) return i < 0 ? -1 : 1;

i = (int)(School ?? SchoolEnum.Unknown) - (int)(o.School ?? SchoolEnum.Unknown);
if (i != 0) return i < 0 ? -1 : 1;

i = Url?.CompareTo(o.Url) ?? 0;
if (i != 0) return i < 0 ? -1 : 1;


return i;
}

public override bool Equals(object? obj)
{
if (obj is not RankingSummaryStudent rankingSummaryStudent) return false;
Expand Down
11 changes: 11 additions & 0 deletions PoliNetwork.Graduatorie.Parser/Utils/Output/StudentHashSummary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,15 @@ public void Merge(StudentResult student, Ranking ranking, CourseTable? courseTab
if (!present2)
RankingSummaries.Add(r);
}

public void Sort2()
{
RankingSummaries.Sort(Compare);
SingleCourseJsons.Sort(Compare);
}

private int Compare(RankingSummaryStudent a, RankingSummaryStudent b)
{
return a.Compare(b);
}
}
2 changes: 1 addition & 1 deletion PoliNetwork.Graduatorie.Scraper/Utils/Web/CheckUrlUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace PoliNetwork.Graduatorie.Scraper.Utils.Web;

public class CheckUrlUtil
public static class CheckUrlUtil
{
private static void CheckUrl(RankingUrl variable, HashSet<RankingUrl> final)
{
Expand Down
5 changes: 2 additions & 3 deletions PoliNetwork.Graduatorie.Scraper/Utils/Web/Scraper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,7 @@ private IEnumerable<string> UseHref(string? href)
private IEnumerable<string> ParseNewsPage(string url)
{
HashSet<string> links = new();
if (_alreadyVisited.Contains(url)) return links;
_alreadyVisited.Add(url);
if (!_alreadyVisited.Add(url)) return links;

var page = _web.Load(url).DocumentNode;

Expand Down Expand Up @@ -190,4 +189,4 @@ private bool IsValidText(string text)
return null;
}
}
}
}