Changeset ad0fcd3
- Timestamp:
- 10/31/21 10:24:17 (3 years ago)
- Branches:
- dev
- Children:
- ad079e5
- Parents:
- 806f4ee
- Location:
- src
- Files:
-
- 3 added
- 2 deleted
- 14 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question-state.models.ts
r806f4ee rad0fcd3 34 34 public correctAnswer!: boolean; 35 35 public createdOn!: moment.Moment; 36 public upvotesCount!: number;36 public votesCount!: number; 37 37 public studentResponse!: AnswerStudentQuestionStateResponse; 38 38 public answerResponsesResponse!: AnswerResponseQuestionStateResponse[]; -
src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.mapper.ts
r806f4ee rad0fcd3 51 51 x.correctAnswer, 52 52 moment(x.createdOn), 53 x. upvotesCount,53 x.votesCount, 54 54 answerStudent, 55 55 answerResponses -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/question-preview/question-preview.component.html
r806f4ee rad0fcd3 14 14 <mat-card-content> 15 15 <div fxLayout="row wrap" fxLayoutAlign="space-around none"> 16 <app-vote [voteCount]="answer. upvotesCount" [correct]="answer.correctAnswer" fxFlex="6%"></app-vote>16 <app-vote [voteCount]="answer.votesCount" [correct]="answer.correctAnswer" fxFlex="6%"></app-vote> 17 17 <div fxFlex="92%"> 18 18 <app-text-editor -
src/Clients/Angular/finki-chattery/src/app/shared-app/models/question-state-view-models.models.ts
r806f4ee rad0fcd3 32 32 public correctAnswer: boolean, 33 33 public createdOn: moment.Moment, 34 public upvotesCount: number,34 public votesCount: number, 35 35 public student: AnswerStudentQuestionStateViewModel, 36 36 public answerResponses: AnswerResponseQuestionStateViewModel[] -
src/FinkiChattery/FinkiChattery.Api/ApplicationServices/Questioning/Mapper/QuestionMapper.cs
r806f4ee rad0fcd3 54 54 var answerStudent = new AnswerStudentQuestionStateResponse(x.StudentDto.Id, x.StudentDto.Uid, x.StudentDto.Index, x.StudentDto.ImageUrl, x.StudentDto.Reputation); 55 55 56 return new AnswerQuestionStateResponse(x.Id, x.Uid, x.Text, x.CorrectAnswer, x.CreatedOn, x. UpvotesCount, answerStudent, answerResponses);56 return new AnswerQuestionStateResponse(x.Id, x.Uid, x.Text, x.CorrectAnswer, x.CreatedOn, x.VotesCount, answerStudent, answerResponses); 57 57 }); 58 58 } -
src/FinkiChattery/FinkiChattery.Contracts/Questioning/GetQuestionState/QuestionStateResponse.cs
r806f4ee rad0fcd3 89 89 public class AnswerQuestionStateResponse 90 90 { 91 public AnswerQuestionStateResponse(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long upvotesCount, AnswerStudentQuestionStateResponse studentResponse, IEnumerable<AnswerResponseQuestionStateResponse> answerResponsesResponse)91 public AnswerQuestionStateResponse(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long votesCount, AnswerStudentQuestionStateResponse studentResponse, IEnumerable<AnswerResponseQuestionStateResponse> answerResponsesResponse) 92 92 { 93 93 Id = id; … … 96 96 CorrectAnswer = correctAnswer; 97 97 CreatedOn = createdOn; 98 UpvotesCount = upvotesCount;98 VotesCount = votesCount; 99 99 StudentResponse = studentResponse; 100 100 AnswerResponsesResponse = answerResponsesResponse; … … 107 107 public bool CorrectAnswer { get; } 108 108 public DateTime CreatedOn { get; } 109 public long UpvotesCount { get; }109 public long VotesCount { get; } 110 110 public AnswerStudentQuestionStateResponse StudentResponse { get; } 111 111 public IEnumerable<AnswerResponseQuestionStateResponse> AnswerResponsesResponse { get; } -
src/FinkiChattery/FinkiChattery.Database/FinkiChattery.Database.sqlproj
r806f4ee rad0fcd3 75 75 <Folder Include="dbo\Tables\QuestionCategory" /> 76 76 <Folder Include="Snapshots" /> 77 <Folder Include="dbo\Tables\Vote" /> 77 78 </ItemGroup> 78 79 <ItemGroup> … … 81 82 <Build Include="dbo\Tables\StudentTeam.sql" /> 82 83 <Build Include="dbo\Tables\TeacherTeam.sql" /> 83 <Build Include="dbo\Tables\Upvote.sql" />84 84 <Build Include="dbo\Tables\User\AspNetRoleClaims.sql" /> 85 85 <Build Include="dbo\Tables\User\AspNetRoles.sql" /> … … 100 100 <Build Include="dbo\Tables\QuestionCategory\QuestionCategory.sql" /> 101 101 <None Include="dbo\Tables\QuestionCategory\QuestionCategory.Debug.Seed.sql" /> 102 <Build Include="dbo\Tables\Vote\Vote.sql" /> 102 103 </ItemGroup> 103 104 <ItemGroup> -
src/FinkiChattery/FinkiChattery.Database/dbo/Tables/Answer/Answer.Debug.Seed.sql
r806f4ee rad0fcd3 12 12 (3, N'cee193c3-9d36-4ed8-81b2-15eb4ff305f1', N'Answer 3', 2, 1, 1, GETUTCDATE(), 5), 13 13 (4, N'dee193c3-9d36-4ed8-81b2-15eb4ff305f1', N'Answer 4', 2, 1, 0, GETUTCDATE(), 5) 14 ) AS temp ([Id], [Uid], [Text], [QuestionFk], [StudentFk], [CorrectAnswer], [CreatedOn], [ UpvotesCount])14 ) AS temp ([Id], [Uid], [Text], [QuestionFk], [StudentFk], [CorrectAnswer], [CreatedOn], [VotesCount]) 15 15 ) AS S 16 16 ON T.[ID] = S.[ID] … … 21 21 T.[StudentFk] = S.[StudentFk], 22 22 T.[CorrectAnswer] = S.[CorrectAnswer], 23 T.[ UpvotesCount] = S.[UpvotesCount]23 T.[VotesCount] = S.[VotesCount] 24 24 WHEN NOT MATCHED THEN 25 25 INSERT … … 32 32 [CorrectAnswer], 33 33 [CreatedOn], 34 [ UpvotesCount]34 [VotesCount] 35 35 ) 36 36 VALUES 37 (S.[Id], S.[Uid], S.[Text], S.[QuestionFk], S.[StudentFk], S.[CorrectAnswer], S.[CreatedOn], S.[ UpvotesCount]);37 (S.[Id], S.[Uid], S.[Text], S.[QuestionFk], S.[StudentFk], S.[CorrectAnswer], S.[CreatedOn], S.[VotesCount]); 38 38 SET IDENTITY_INSERT [dbo].[Answer] OFF 39 39 END -
src/FinkiChattery/FinkiChattery.Database/dbo/Tables/Answer/Answer.sql
r806f4ee rad0fcd3 7 7 [CorrectAnswer] BIT NOT NULL, 8 8 [CreatedOn] SMALLDATETIME NOT NULL, 9 [ UpvotesCount] BIGINT NOT NULL DEFAULT 0,9 [VotesCount] BIGINT NOT NULL DEFAULT 0, 10 10 CONSTRAINT [PK_Answer] PRIMARY KEY CLUSTERED ([Id] ASC), 11 11 CONSTRAINT [FK_Answer_Question_QuestionFk] FOREIGN KEY ([QuestionFk]) REFERENCES [dbo].[Question] ([Id]), -
src/FinkiChattery/FinkiChattery.Persistence/Configurations/AnswerConfig.cs
r806f4ee rad0fcd3 22 22 builder.Property(x => x.CorrectAnswer).HasColumnName(@"CorrectAnswer").HasColumnType("bit").IsRequired(); 23 23 builder.Property(x => x.CreatedOn).HasColumnName(@"CreatedOn").HasColumnType("smalldatetime").IsRequired(); 24 builder.Property(x => x. UpvotesCount).HasColumnName(@"UpvotesCount").HasColumnType("bigint").IsRequired().HasDefaultValue(0);24 builder.Property(x => x.VotesCount).HasColumnName(@"VotesCount").HasColumnType("bigint").IsRequired().HasDefaultValue(0); 25 25 26 26 builder.HasOne(x => x.Question).WithMany(x => x.Answers).HasForeignKey(x => x.QuestionFk).OnDelete(DeleteBehavior.Restrict); -
src/FinkiChattery/FinkiChattery.Persistence/Context/ApplicationDbContext.cs
r806f4ee rad0fcd3 23 23 public DbSet<TeacherTeam> TeacherTeams { get; set; } 24 24 public DbSet<Team> Teams { get; set; } 25 public DbSet< Upvote> Upvotes { get; set; }25 public DbSet<Vote> Votes { get; set; } 26 26 27 27 protected override void OnModelCreating(ModelBuilder builder) … … 42 42 builder.ApplyConfiguration(new TeacherTeamConfig(schema)); 43 43 builder.ApplyConfiguration(new TeamConfig(schema)); 44 builder.ApplyConfiguration(new UpvoteConfig(schema));44 builder.ApplyConfiguration(new VoteConfig(schema)); 45 45 } 46 46 } -
src/FinkiChattery/FinkiChattery.Persistence/Models/Answer.cs
r806f4ee rad0fcd3 20 20 public DateTime CreatedOn { get; set; } 21 21 22 public long UpvotesCount { get; set; }22 public long VotesCount { get; set; } 23 23 24 public virtual ICollection< Upvote> Upvotes { get; set; }24 public virtual ICollection<Vote> Votes { get; set; } 25 25 26 26 public virtual ICollection<AnswerResponse> AnswerResponses { get; set; } -
src/FinkiChattery/FinkiChattery.Persistence/Models/Vote.cs
r806f4ee rad0fcd3 1 using System; 2 using System.Collections.Generic; 3 using System.Linq; 4 using System.Text; 5 using System.Threading.Tasks; 1 using FinkiChattery.Persistence.Helpers; 6 2 7 3 namespace FinkiChattery.Persistence.Models 8 4 { 9 public class Upvote : BaseEntity5 public class Vote : BaseEntity 10 6 { 11 7 public long StudentFk { get; set; } … … 16 12 17 13 public virtual Answer Answer { get; set; } 14 15 public VoteType VoteType { get; set; } 18 16 } 19 17 } -
src/FinkiChattery/FinkiChattery.Persistence/Repositories/Contracts/Question/QuestionStateDto.cs
r806f4ee rad0fcd3 84 84 public class AnswerQuestionStateDto 85 85 { 86 public AnswerQuestionStateDto(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long upvotesCount, AnswerStudentQuestionStateDto studentDto, IEnumerable<AnswerResponseQuestionStateDto> answerResponsesDto)86 public AnswerQuestionStateDto(long id, Guid uid, string text, bool correctAnswer, DateTime createdOn, long votesCount, AnswerStudentQuestionStateDto studentDto, IEnumerable<AnswerResponseQuestionStateDto> answerResponsesDto) 87 87 { 88 88 Id = id; … … 91 91 CorrectAnswer = correctAnswer; 92 92 CreatedOn = createdOn; 93 UpvotesCount = upvotesCount;93 VotesCount = votesCount; 94 94 StudentDto = studentDto; 95 95 AnswerResponsesDto = answerResponsesDto; … … 101 101 public bool CorrectAnswer { get; } 102 102 public DateTime CreatedOn { get; } 103 public long UpvotesCount { get; }103 public long VotesCount { get; } 104 104 public AnswerStudentQuestionStateDto StudentDto { get; } 105 105 public IEnumerable<AnswerResponseQuestionStateDto> AnswerResponsesDto { get; } -
src/FinkiChattery/FinkiChattery.Persistence/Repositories/Implementations/QuestionRepo.cs
r806f4ee rad0fcd3 80 80 y.CorrectAnswer, 81 81 y.CreatedOn, 82 y. UpvotesCount,82 y.VotesCount, 83 83 new AnswerStudentQuestionStateDto( 84 84 y.Student.Id,
Note:
See TracChangeset
for help on using the changeset viewer.