Skip to content

Commit

Permalink
[FIX] Save & Visiting page
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyalehchylin committed May 12, 2023
2 parents cfa3782 + dbe4ac0 commit 7e16ef2
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 24 deletions.
6 changes: 3 additions & 3 deletions source/EduCATS/Localization/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

"type_activity_lecture": "Лекция",
"type_activity_lab": "Лаб. работа",
"type_activity_practical": "Практ. работа",
"type_activity_practical": "Практ. занятие",

"server_test": "Тестовый сервер",
"server_local": "Локальный сервер",
Expand Down Expand Up @@ -217,8 +217,8 @@
"set_visiting": "Выставить пропуски",
"save_marks": "Сохранить",

"practiсe_visiting": "Пропуски практических работ",
"practice_mark": "Оценки по практическим работам",
"practiсe_visiting": "Пропуски практических занятий",
"practice_mark": "Оценки по практическим занятиям",

"sub_group": "Подгруппа ",
"mark": "Оценка",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public Command SaveMarksButton
}
}

private async Task<KeyValuePair<string, HttpStatusCode>> saveMarks()
private async Task saveMarks()
{
string body = "";
string link = "";
Expand All @@ -72,6 +72,7 @@ public Command SaveMarksButton
foreach (var pract in _takedLabs.Practicals.Where(v => v.ShortName == SelectedShortName))
{
save.practicalId = pract.PracticalId;
save.subjectId = _services.Preferences.ChosenSubjectId;
foreach (var practic in fullPractice.Students.Where(v => v.FullName == studentName))
{
save.studentId = practic.StudentId;
Expand Down Expand Up @@ -109,8 +110,11 @@ public Command SaveMarksButton
}
body = JsonController.ConvertObjectToJson(save);
}

await AppServicesController.Request(link, body);
await _services.Navigation.ClosePage(false);
return await AppServicesController.Request(link, body);

return;
}

string _selectedShortName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class SaveSingleStudentMarkPageView : ContentPage
{
static Thickness _gridPadding = new Thickness(15);
const double _controlHeight = 50;
const double _heightRequest = 30;
const double _heightRequest = 40;

static Thickness _padding = new Thickness(10, 1);
public List<int> Marks = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
Expand Down Expand Up @@ -103,7 +103,7 @@ public SaveSingleStudentMarkPageView(string title, string name, LabsVisitingList
VerticalOptions = LayoutOptions.CenterAndExpand,
TextColor = Color.FromHex(Theme.Current.StatisticsDetailsTitleColor),
Style = AppStyles.GetLabelStyle(),
HeightRequest = _heightRequest,
HeightRequest = 50,
Text = CrossLocalization.Translate("show_for_student"),
};

Expand Down Expand Up @@ -161,6 +161,13 @@ public SaveSingleStudentMarkPageView(string title, string name, LabsVisitingList

saveBut.SetBinding(Button.CommandProperty, "SaveMarksButton");

gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(3, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(5, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(6, GridUnitType.Auto) });

gridLayout.Children.Add(inicials, 0, 0);
gridLayout.Children.Add(nameOfPrOrLb, 0, 1);
gridLayout.Children.Add(markLabel, 0, 2);
Expand All @@ -178,6 +185,9 @@ public SaveSingleStudentMarkPageView(string title, string name, LabsVisitingList
Grid.SetColumnSpan(markLabel, 2);
Grid.SetColumnSpan(saveBut, 3);
Grid.SetColumnSpan(nameOfPrOrLb, 3);

gridLayout.RowSpacing = 10;

Content = gridLayout;
}

Expand Down
1 change: 1 addition & 0 deletions source/EduCATS/Pages/SaveMarks/SavePractSingle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ public class SavePractSingle
public int mark { get; set; }
public bool showForStudent { get; set; }
public int studentId { get; set; }
public int subjectId { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,10 @@ public string SelectedSubGroup
}
DateLabs = Date1;
LabsVisitingMarksSubGroup = _currentLabsVisitingMarksSubGroup1;
SelectedLabDate = DateLabs[DateLabs.Count - 1];

if (DateLabs.Count != 0)
SelectedLabDate = DateLabs[DateLabs.Count - 1];

return _selectedSubGroup;
}
set
Expand Down
2 changes: 1 addition & 1 deletion source/EduCATS/Pages/SaveMarks/Views/SaveMarksPageView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class SaveMarksPageView : ContentPage

static Thickness _padding = new Thickness(10, 1);
static Thickness _headerPadding = new Thickness(0, 10, 0, 10);
static int _heightRequest = 30;
static int _heightRequest = 40;
private string _groupName;
const double _controlHeight = 50;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public VisitingPageViewCell()
var markPicker = new Picker
{
BackgroundColor = Color.White,
HeightRequest = 30,
HeightRequest = 40,
ItemsSource = listOfMarks,
HorizontalTextAlignment = TextAlignment.Center
};
Expand All @@ -80,7 +80,7 @@ public VisitingPageViewCell()
{
Style = entryStyle,
ReturnType = ReturnType.Done,
HeightRequest = 30
HeightRequest = 40
};

commentEntry.SetBinding(Entry.TextProperty, "Comment");
Expand All @@ -90,7 +90,11 @@ public VisitingPageViewCell()
Padding = _gridPadding,
VerticalOptions = LayoutOptions.CenterAndExpand,
};


gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Auto) });
gridLayout.RowDefinitions.Add(new RowDefinition { Height = new GridLength(3, GridUnitType.Auto) });
gridLayout.Children.Add(inicials, 0, 0);
gridLayout.Children.Add(markLabel, 0, 1);
gridLayout.Children.Add(markPicker, 2, 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,24 +403,30 @@ void setLabsVisiting(StatsStudentModel student, LaboratoryWorksModel labs)
}
}

var labsVisitingList = _currentLabsVisitingList.OrderBy(vis => DateTime.Parse(vis.Date)).ToList();

var visitingLabsTestResult = labs.LabVisitingMark.Select(v =>
List<StatsResultsPageModel> temp = new List<StatsResultsPageModel>();

foreach (var vis in labsVisitingList)
{
var lab = _currentLabsVisitingList.FirstOrDefault(
l => l.ProtectionLabId == v.ScheduleProtectionLabId);
var lab = labs.LabVisitingMark.FirstOrDefault(l => l.ScheduleProtectionLabId == vis.ProtectionLabId);

Theme theme = null;
if (queueTheme.Count > 0)
if (lab != null)
{
theme = queueTheme.Dequeue();
}
Theme theme = null;
if (queueTheme.Count > 0)
{
theme = queueTheme.Dequeue();
}

var labTitle = lab == null ? null : $"{theme.ShortName}. {theme.LabTheme}";
var result = string.IsNullOrEmpty(v.Mark) ? _emptyRatingString : v.Mark;
return new StatsResultsPageModel(labTitle, lab?.Date, setCommentByRole(v.Comment, v.ShowForStudent), result);
});
var labTitle = lab == null ? null : $"{theme.ShortName}. {theme.LabTheme}";
var result = string.IsNullOrEmpty(lab.Mark) ? _emptyRatingString : lab.Mark;

temp.Add(new StatsResultsPageModel(labTitle, vis?.Date, setCommentByRole(lab.Comment, lab.ShowForStudent), result));
}
}
;
Marks = new List<StatsResultsPageModel>(visitingLabsTestResult).OrderBy(x => DateTime.Parse(x.Date)).ToList();
Marks = new List<StatsResultsPageModel>(temp);
}
else
{
Expand Down

0 comments on commit 7e16ef2

Please sign in to comment.