Skip to content

Commit b402b22

Browse files
committed
Solution: показывать, что решение было отредактировано
1 parent 6ba95e2 commit b402b22

8 files changed

Lines changed: 117 additions & 3 deletions

File tree

HwProj.Common/HwProj.Models/SolutionsService/GetSolutionModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ public GetSolutionModel(Solution model, AccountDataDto[]? groupMates, AccountDat
1919
?? Array.Empty<AccountDataDto>();
2020
LecturerComment = model.LecturerComment;
2121
PublicationDate = model.PublicationDate;
22+
IsModified = model.IsModified;
2223
Rating = model.Rating;
2324
StudentId = model.StudentId;
2425
TaskId = model.TaskId;
@@ -44,6 +45,7 @@ public GetSolutionModel(Solution model, AccountDataDto[]? groupMates, AccountDat
4445
public long TaskId { get; set; }
4546

4647
public DateTime PublicationDate { get; set; }
48+
public bool IsModified { get; set; }
4749

4850
public string LecturerComment { get; set; }
4951

HwProj.Common/HwProj.Models/SolutionsService/Solution.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ public class Solution : IEntity<long>
2424
public long TaskId { get; set; }
2525

2626
public DateTime PublicationDate { get; set; }
27-
27+
public bool IsModified { get; set; }
28+
2829
public DateTime? RatingDate { get; set; }
2930

3031
public string LecturerComment { get; set; }

HwProj.SolutionsService/HwProj.SolutionsService.API/Migrations/20250909235525_SolutionIsModified.Designer.cs

Lines changed: 74 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using Microsoft.EntityFrameworkCore.Migrations;
2+
3+
namespace HwProj.SolutionsService.API.Migrations
4+
{
5+
public partial class SolutionIsModified : Migration
6+
{
7+
protected override void Up(MigrationBuilder migrationBuilder)
8+
{
9+
migrationBuilder.AddColumn<bool>(
10+
name: "IsModified",
11+
table: "Solutions",
12+
nullable: false,
13+
defaultValue: false);
14+
}
15+
16+
protected override void Down(MigrationBuilder migrationBuilder)
17+
{
18+
migrationBuilder.DropColumn(
19+
name: "IsModified",
20+
table: "Solutions");
21+
}
22+
}
23+
}

HwProj.SolutionsService/HwProj.SolutionsService.API/Migrations/SolutionContextModelSnapshot.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)
3131

3232
b.Property<long?>("GroupId");
3333

34+
b.Property<bool>("IsModified");
35+
3436
b.Property<string>("LecturerComment");
3537

3638
b.Property<string>("LecturerId");

HwProj.SolutionsService/HwProj.SolutionsService.API/Services/SolutionsService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ await _solutionsRepository
125125
GithubUrl = solution.GithubUrl,
126126
Comment = solution.Comment,
127127
GroupId = solution.GroupId,
128+
IsModified = true,
128129
State = SolutionState.Posted,
129-
PublicationDate = solution.PublicationDate,
130130
});
131131
solutionId = lastSolution.Id;
132132
}

hwproj.front/src/api/api.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,12 @@ export interface GetSolutionModel {
936936
* @memberof GetSolutionModel
937937
*/
938938
publicationDate?: Date;
939+
/**
940+
*
941+
* @type {boolean}
942+
* @memberof GetSolutionModel
943+
*/
944+
isModified?: boolean;
939945
/**
940946
*
941947
* @type {string}
@@ -1823,6 +1829,12 @@ export interface Solution {
18231829
* @memberof Solution
18241830
*/
18251831
publicationDate?: Date;
1832+
/**
1833+
*
1834+
* @type {boolean}
1835+
* @memberof Solution
1836+
*/
1837+
isModified?: boolean;
18261838
/**
18271839
*
18281840
* @type {Date}

hwproj.front/src/components/Solutions/TaskSolutionComponent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ const TaskSolutionComponent: FC<ISolutionProps> = (props) => {
471471
: <CircularProgress size={12}/>)}
472472
</Stack>
473473
<Typography variant={"caption"} style={{color: "GrayText"}}>
474-
{postedSolutionTime}
474+
{postedSolutionTime} {solution.isModified && "(отредактировано)"}
475475
</Typography>
476476
</Grid>
477477
</Stack>

0 commit comments

Comments
 (0)